:root {
  --primary: #1a73e8;
  --primary-dark: #1765cc;
  --primary-soft: #e8f0fe;
  --primary-soft-text: #1967d2;
  --bg: #f6f8fa;
  --surface: #ffffff;
  --text: #202124;
  --text-secondary: #5f6368;
  --text-muted: #80868b;
  --border: #dde1e6;
  --border-light: #eceff2;
  --ring-track: #e8eaed;
  --green: #34a853;
  --green-soft: #e6f4ea;
  --green-text: #137333;
  --warn-bg: #fef7e0;
  --warn-text: #b06000;
  --error: #d93025;
  --radius-s: 10px;
  --radius-m: 14px;
  --radius-l: 18px;
  --shadow-1: 0 1px 2px rgba(60,64,67,0.12), 0 1px 4px rgba(60,64,67,0.08);
  --shadow-2: 0 2px 6px rgba(60,64,67,0.15), 0 6px 16px rgba(60,64,67,0.10);
  --tap: 44px;
}

html, body { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Google Sans", Roboto, "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 20px calc(56px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  flex: none;
  box-shadow: var(--shadow-1);
}
.brand { display: grid; line-height: 1.3; min-width: 0; }
.title { font-size: 18px; font-weight: 700; letter-spacing: 0.01em; }
.subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.account-bar { position: relative; flex: none; }
.icon-btn {
  position: relative;
  width: var(--tap);
  height: var(--tap);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  font: inherit;
  padding: 0;
}
.icon-btn i { color: var(--primary); font-size: 20px; }
.icon-btn:hover { background: #f8fbff; border-color: #d2e3fc; }
.account-chip {
  min-height: var(--tap);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px 0 10px;
  cursor: pointer;
  touch-action: manipulation;
  max-width: 220px;
}
.account-chip > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-chip i { color: var(--primary); font-size: 19px; flex: none; }
.account-chip .chev { color: var(--text-muted); font-size: 14px; }
.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  width: min(320px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-2);
  padding: 16px;
  display: grid;
  gap: 12px;
}
.account-menu-head { display: grid; gap: 6px; justify-items: start; }
.account-menu-head p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.account-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f1f3f4;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
}
.account-badge.free { background: var(--primary-soft); color: var(--primary-soft-text); }
.account-badge.paid { background: var(--green-soft); color: var(--green-text); }
.account-meter { display: grid; gap: 6px; }
.meter-track {
  height: 8px;
  border-radius: 999px;
  background: var(--ring-track);
  overflow: hidden;
}
.meter-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.25s ease;
}
.meter-fill.paid { background: var(--green); }
.quota-text { font-size: 12px; color: var(--text-secondary); }
.account-menu-actions { display: grid; gap: 8px; }
.account-primary-btn, .account-secondary-btn {
  min-height: var(--tap);
  border-radius: 999px;
  font: inherit;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px;
  cursor: pointer;
  touch-action: manipulation;
}
.account-primary-btn {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}
.account-primary-btn i { color: inherit; font-size: 16px; }
.account-secondary-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: #3c4043;
}
.account-secondary-btn i { color: var(--primary); font-size: 16px; }
.account-primary-btn:disabled, .account-secondary-btn:disabled { opacity: 0.65; cursor: wait; }

/* ---------- notices ---------- */
.billing-notice {
  border: 1px solid #d2e3fc;
  background: #f8fbff;
  color: #174ea6;
  border-radius: var(--radius-s);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}
.billing-notice.warn {
  border-color: #fdd663;
  background: #fff8e1;
  color: #8a4b00;
}

/* ---------- login banner ---------- */
.login-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-m);
  padding: 12px 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-1);
}
.login-banner > i { font-size: 26px; color: var(--primary); flex: none; }
.login-banner-copy { display: grid; min-width: 0; flex: 1; line-height: 1.5; }
.login-banner-copy strong { font-size: 13.5px; font-weight: 500; }
.login-banner-copy span { font-size: 12px; color: var(--text-secondary); }
.banner-login-btn {
  flex: none;
  min-height: var(--tap);
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  touch-action: manipulation;
}
.banner-login-btn i { font-size: 16px; }

/* ---------- history (topbar dropdown) ---------- */
.history-bar { position: relative; flex: none; }
.history-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
}
.history-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 55;
  width: min(360px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-2);
  padding: 12px;
  display: grid;
  gap: 10px;
}
.history-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.history-menu-title {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.history-count { font-size: 12px; color: var(--text-muted); }
.history-list {
  display: grid;
  gap: 8px;
  max-height: min(360px, 50vh);
  overflow: auto;
}
.history-empty {
  margin: 0;
  padding: 16px 8px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.history-item {
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 10px 11px;
  text-align: left;
  font: inherit;
  touch-action: manipulation;
  box-sizing: border-box;
}
.history-item:hover { background: #f8fbff; border-color: #d2e3fc; }
.history-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.history-title {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
  color: var(--text-secondary);
  font-size: 11.5px;
  line-height: 1.5;
}
.history-meta span {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* ---------- mode toggle ---------- */
.mode-toggle {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  background: #e9edf1;
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 18px;
  overflow: hidden;
  min-height: 44px;
}
.mode-slider {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / 4);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(60,64,67,0.24);
  transition: transform 0.3s cubic-bezier(0.2,0,0,1);
  pointer-events: none;
}
.mode-toggle[data-active="text"] .mode-slider { transform: translateX(100%); }
.mode-toggle[data-active="description"] .mode-slider { transform: translateX(200%); }
.mode-toggle[data-active="corpus"] .mode-slider { transform: translateX(300%); }
.mode-btn {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  min-height: 44px;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  border-radius: 999px;
  color: var(--text-secondary);
  touch-action: manipulation;
  padding: 0 6px;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 5px;
  line-height: 1.2;
}
.mode-btn i {
  font-size: 17px;
  flex: none;
  color: inherit;
  opacity: 0.85;
}
.mode-btn.active i { opacity: 1; }
.mode-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.mode-from { font-size: 0.92em; }
.mode-btn.active { color: var(--primary); font-weight: 500; }
.panel.hidden { display: none; }

/* ---------- inputs ---------- */
.input-grid { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.field-block { flex: 1 1 100%; min-width: 0; }
.field-label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 7px; font-weight: 500; }
.optional { color: var(--text-muted); font-weight: 400; }
.field-hint {
  margin: -8px 0 16px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
}
textarea {
  width: 100%;
  min-height: 100px;
  height: 100px;
  resize: vertical;
  box-sizing: border-box;
  font: inherit;
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}
textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

/* ---------- dropzone ---------- */
.dropzone {
  position: relative;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-l);
  padding: 18px 12px 14px;
  text-align: center;
  background: var(--surface);
  color: var(--text-secondary);
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
  touch-action: manipulation;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: #f8fbff; box-shadow: 0 1px 6px rgba(26,115,232,0.12); }
.dropzone.has-image { border-style: solid; border-color: var(--border-light); }
.dropzone-body i { font-size: 28px; color: var(--primary); display: block; margin-bottom: 6px; }
.dropzone-body i.muted { color: var(--text-muted); }
.dropzone.has-image .dropzone-body > i { display: none; }
.dropzone-label { display: block; font-size: 13px; font-weight: 500; color: #3c4043; overflow-wrap: anywhere; }
.dropzone-hint { display: block; font-size: 11.5px; color: var(--text-muted); margin-top: 2px; min-height: 1em; }
.dropzone-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}
.pick-btn {
  flex: 1;
  max-width: 180px;
  min-height: var(--tap);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: #3c4043;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  touch-action: manipulation;
}
.pick-btn i { font-size: 17px; color: var(--primary); }
.pick-btn:active { background: #f1f3f4; }
.dropzone-preview {
  display: block;
  max-width: 100%;
  max-height: 180px;
  margin: 4px auto 8px;
  border-radius: var(--radius-s);
  object-fit: contain;
}
.clear-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(32,33,36,0.7);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  z-index: 2;
}

/* ---------- chips & actions ---------- */
.search-mode-row { margin-bottom: 12px; }
.search-mode-row .field-label { display: block; margin-bottom: 7px; }
.action-row { margin: 16px 0 20px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.search-action-bar { margin: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: #3c4043;
  cursor: pointer;
  font-family: inherit;
  touch-action: manipulation;
}
.chip.on { background: var(--primary-soft); color: var(--primary-soft-text); border-color: transparent; font-weight: 500; }
.primary-btn, .secondary-btn {
  border: none;
  cursor: pointer;
  font: inherit;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  touch-action: manipulation;
}
.primary-btn {
  width: 100%;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  min-height: 50px;
  padding: 0 24px;
  box-shadow: var(--shadow-1);
}
.primary-btn:hover:not(:disabled) { background: var(--primary-dark); }
.primary-btn:disabled { opacity: 0.7; cursor: wait; }
.secondary-btn {
  width: 100%;
  background: #eef1f4;
  color: #3c4043;
  font-size: 14px;
  min-height: var(--tap);
  padding: 0 16px;
}

/* ---------- corpus tab panel ---------- */
.corpus-intro {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--green-text);
  background: var(--green-soft);
  border-radius: var(--radius-s);
  padding: 10px 12px;
}
.corpus-intro strong { font-weight: 600; }
#corpusPanel .picker-row { display: grid; gap: 12px; margin-bottom: 0; }
#corpusPanel .picker-row input,
#corpusPanel .picker-row select {
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  width: 100%;
  box-sizing: border-box;
  background: var(--surface);
}
#corpusPanel .picker-row select {
  min-height: 180px;
}

/* ---------- pickers / preview ---------- */
.query-preview {
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-1);
}
.query-preview summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  padding: 4px 14px;
  cursor: pointer;
  touch-action: manipulation;
}
.query-preview pre { white-space: pre-wrap; background: var(--bg); padding: 12px; border-radius: var(--radius-s); margin: 0 12px 12px; }

/* ---------- results ---------- */
.results-header { display: flex; align-items: baseline; gap: 8px; margin: 20px 0 12px; flex-wrap: wrap; }
.results-title { font-size: 15.5px; font-weight: 700; flex: 1 1 auto; min-width: 0; }
.results-count, .results-sort { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.results-sort { margin-left: auto; }
.search-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--primary-soft);
  color: var(--primary-soft-text);
  border-radius: var(--radius-s);
  padding: 11px 14px;
  font-size: 13.5px;
  margin-bottom: 12px;
}
.search-progress i { font-size: 18px; flex: none; }
.progress-elapsed { margin-left: auto; font-size: 12px; color: var(--primary); font-variant-numeric: tabular-nums; }
.result-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-l);
  padding: 14px 12px;
  margin-bottom: 10px;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
  touch-action: manipulation;
  box-sizing: border-box;
  box-shadow: var(--shadow-1);
}
.result-card:active { transform: scale(0.99); background: #f8f9fa; }
.result-card:hover { box-shadow: var(--shadow-2); border-color: transparent; transform: translateY(-1px); }
.result-card > .ti-chevron-right { color: var(--text-muted); }
.sim-ring { position: relative; width: 48px; height: 48px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 500; color: var(--primary); }
.sim-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.result-main { flex: 1; min-width: 0; }
.result-title { font-size: 15px; font-weight: 500; }
.result-qno { font-size: 12.5px; color: var(--text-secondary); margin-left: 8px; font-weight: 400; }
.tags { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.tag { font-size: 11.5px; padding: 2px 10px; border-radius: 6px; line-height: 1.7; }
.tag.blue { background: var(--primary-soft); color: var(--primary-soft-text); }
.tag.gray { background: #f1f3f4; color: var(--text-secondary); }
.skeleton .bar { height: 78px; border-radius: var(--radius-l); margin-bottom: 10px; background: linear-gradient(100deg, #eceff2 40%, #f7f9fa 50%, #eceff2 60%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.notice, .error { font-size: 11.5px; color: var(--text-muted); margin: 16px 4px 2px; }
.error {
  color: var(--error);
  background: #fce8e6;
  border-radius: var(--radius-s);
  padding: 10px 12px;
  font-size: 13px;
  margin: 0 0 12px;
}
.hidden { display: none !important; }

/* ---------- detail ---------- */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 10px 10px;
  margin-bottom: 18px;
  background: none;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  color: var(--text-secondary);
  touch-action: manipulation;
  min-height: var(--tap);
}
.back-btn:hover { background: #eceff2; }
.detail-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.detail-head h2 { margin: 0; font-size: 19px; line-height: 1.4; word-break: break-word; font-weight: 700; }
.sim-badge { width: 72px; height: 72px; border-radius: 50%; border: 5px solid var(--primary-soft); background: var(--surface); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 500; color: var(--primary); flex: none; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 14px; }
.card { background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius-l); padding: 15px 17px; box-shadow: var(--shadow-1); }
.card.warn { background: var(--warn-bg); border-color: transparent; }
.card-title { font-size: 12.5px; font-weight: 500; color: var(--primary); margin-bottom: 6px; }
.card-title.warn { color: var(--warn-text); }
.section-title { font-size: 15px; font-weight: 700; margin: 22px 2px 14px; }
.steps { background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius-l); padding: 16px; box-shadow: var(--shadow-1); }
.step { display: flex; gap: 16px; margin-bottom: 12px; }
.step:last-child { margin-bottom: 0; }
.step-no { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 500; flex: none; }
.step-action { font-size: 14px; font-weight: 500; }
.step-purpose { font-size: 12.5px; color: var(--text-secondary); }
.card .katex-display { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
.card, .step-action, .step-purpose { overflow-wrap: anywhere; word-break: break-word; }
.detail-footer { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--text-muted); border-top: 1px solid var(--border-light); padding-top: 14px; margin-top: 16px; flex-wrap: wrap; }
#detailSimilarBtn { margin-top: 8px; background: var(--surface); border: 1px solid var(--border); }

/* ---------- screen transition ---------- */
.screen-enter { animation: screenIn 0.22s ease-out; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .screen-enter { animation: none; }
}

/* ---------- desktop ---------- */
@media (min-width: 641px) {
  .mode-btn {
    font-size: 13px;
    padding: 0 8px;
  }
  .mode-btn i { font-size: 18px; }
  .field-block { flex: 1; min-width: 240px; }
  .action-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 20px 0 26px;
  }
  .toolbar { flex: 1 1 auto; }
  .search-action-bar { flex: 0 0 auto; }
  .primary-btn { width: auto; font-size: 14px; min-height: 44px; }
  .secondary-btn { width: auto; font-size: 13px; }
}

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .page { padding-top: 8px; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
  .topbar { gap: 10px; margin-bottom: 12px; }
  .subtitle { display: none; }
  .account-chip { max-width: 46vw; }
  .mode-toggle { margin-bottom: 16px; }
  .mode-btn { font-size: 11px; padding: 0 4px; gap: 4px; }
  .mode-from { display: none; }
  .mode-btn i { font-size: 18px; }
  .dropzone { padding: 16px 10px 12px; }
  .dropzone-actions { flex-direction: row; }
  .pick-btn { max-width: none; }
  .search-mode-row .chips { gap: 6px; }
  .search-mode-row .chip { font-size: 12.5px; padding: 0 12px; }
  .results-sort { display: none; }
  .result-title { font-size: 14px; }
  .result-qno { display: block; margin-left: 0; margin-top: 2px; }
  .sim-ring { width: 44px; height: 44px; font-size: 13px; }
  .sim-ring svg { width: 44px; height: 44px; }
  .sim-badge { width: 60px; height: 60px; font-size: 17px; border-width: 4px; }
  .detail-grid { grid-template-columns: 1fr; }
  .notice { font-size: 11px; line-height: 1.6; }
  .login-banner { flex-wrap: wrap; }
  .login-banner-copy { flex: 1 1 60%; }
  .banner-login-btn { margin-left: auto; }
  .search-action-bar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    margin: 0 0 16px;
    width: 100%;
    padding: 10px 4px calc(10px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    background: linear-gradient(180deg, rgba(246,248,250,0) 0%, rgba(246,248,250,0.92) 24%, var(--bg) 100%);
    backdrop-filter: blur(8px);
  }
  .search-action-bar .primary-btn {
    width: 100%;
    box-shadow: 0 2px 8px rgba(26,115,232,0.28);
    min-height: 50px;
    font-size: 15px;
  }
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; }

@media (max-width: 380px) {
  .mode-label { display: none; }
}
