/* === Tokens === */
:root {
  --bg-cream: #f4ede0;
  --bg-cream-soft: #faf6ed;
  --text-warm: #2b231a;
  --text-mid: #5e524a;
  --text-soft: #8a7d72;
  --coral: #d97757;
  --coral-soft: #e69b7e;
  --line: #e3d9c7;
  --line-soft: #efe7d6;
  --card-bg: #ffffff;
  --shadow-card: 0 1px 2px rgba(60, 42, 20, 0.05), 0 8px 24px rgba(60, 42, 20, 0.08);
  --arb-indigo: #4a5fd9;
  --arb-orange: #f08537;
  --arb-teal: #22c0a4;
  --naniwa-navy: #1a3a5c;
  --naniwa-orange: #f08537;
  --radius-card: 18px;
  --radius-bubble: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  background: #1a1612;
  color: var(--text-warm);
  min-height: 100vh;
}

/* === Stage (centers phone on desktop, fullscreen on mobile) === */
.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px 72px;
  background:
    radial-gradient(1200px 600px at 50% 0%, rgba(217, 119, 87, 0.18), transparent 60%),
    radial-gradient(900px 500px at 50% 100%, rgba(74, 95, 217, 0.14), transparent 60%),
    #1a1612;
}

.phone {
  position: relative;
  width: 390px;
  height: 844px;
  max-height: calc(100vh - 56px);
  background: var(--bg-cream);
  border-radius: 44px;
  border: 12px solid #0a0807;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 30px 80px rgba(0, 0, 0, 0.5),
    0 12px 30px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  display: grid;
  grid-template-rows: 44px 52px 1fr auto 22px;
}

@media (max-width: 480px) {
  html, body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    background: var(--bg-cream);
  }
  .stage {
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
  }
  .phone {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    /* OS already renders real status bar / home indicator — reserve their
       real safe-area space and hide our simulated ones below. */
    grid-template-rows:
      env(safe-area-inset-top, 8px)
      52px
      1fr
      auto
      env(safe-area-inset-bottom, 8px);
  }
  .status-bar { visibility: hidden; pointer-events: none; }
  .home-indicator::after { display: none; }
}

/* === Status bar === */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-warm);
}
.status-time { letter-spacing: -0.01em; }
.status-icons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ico-sig, .ico-wifi { width: 18px; height: 12px; }
.ico-batt {
  width: 26px; height: 12px;
  border: 1.4px solid var(--text-warm);
  border-radius: 3px;
  position: relative;
  padding: 1px;
}
.ico-batt::after {
  content: "";
  position: absolute;
  right: -3px; top: 3px;
  width: 2px; height: 4px;
  background: var(--text-warm);
  border-radius: 0 1px 1px 0;
}
.ico-batt-fill {
  display: block;
  width: 80%;
  height: 100%;
  background: var(--text-warm);
  border-radius: 1px;
}

/* === Top nav === */
.top-nav {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: 0 8px;
  border-bottom: 1px solid var(--line-soft);
}
.nav-btn {
  background: transparent;
  border: 0;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  color: var(--text-warm);
  cursor: pointer;
  border-radius: 10px;
}
.nav-btn:hover { background: rgba(0,0,0,0.04); }
.nav-btn svg { width: 22px; height: 22px; }
.nav-title {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-warm);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === Chat scroll === */
.chat {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.chat::-webkit-scrollbar { width: 0; }

/* Message base */
.msg { display: flex; gap: 8px; max-width: 100%; animation: msgIn 0.32s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* User bubble */
.msg.user { justify-content: flex-end; }
.msg.user .bubble {
  background: rgba(180, 150, 110, 0.14);
  border: 1px solid var(--line);
  color: var(--text-warm);
  padding: 10px 14px;
  border-radius: var(--radius-bubble);
  border-bottom-right-radius: 6px;
  max-width: 80%;
  font-size: 14.5px;
  line-height: 1.55;
  word-break: break-word;
}

/* Assistant */
.msg.assistant {
  align-items: flex-start;
}
.msg.assistant .avatar {
  flex: 0 0 28px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #fff;
  display: grid; place-items: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  margin-top: 2px;
}
.msg.assistant .avatar svg { width: 16px; height: 16px; }
.msg.assistant > .bubble {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-warm);
  padding: 4px 2px;
  max-width: calc(100% - 36px);
}

/* Typing dots */
.msg.typing .bubble {
  background: rgba(180, 150, 110, 0.14);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.msg.typing .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-soft);
  animation: pulse 1.2s infinite;
}
.msg.typing .dot:nth-child(2) { animation-delay: 0.15s; }
.msg.typing .dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

/* === MCP card === */
.mcp-wrap { width: 100%; }
.mcp-wrap > .avatar + .bubble,
.mcp-wrap > .avatar { display: none; }
.mcp-card {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-left: 36px;
  max-width: calc(100% - 36px);
}
.mcp-head {
  display: grid;
  grid-template-columns: 36px 1fr 28px;
  gap: 10px;
  padding: 12px 12px 10px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
}
.mcp-logo.arb-logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--arb-indigo), #6873e6);
  color: white;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.04em;
  display: grid; place-items: center;
}
.mcp-titles { line-height: 1.2; }
.mcp-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-warm);
}
.mcp-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 2px;
  background: var(--line-soft);
  padding: 2px 8px;
  border-radius: 999px;
}
.dot-on {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #22c0a4;
  box-shadow: 0 0 0 3px rgba(34, 192, 164, 0.15);
}
.mcp-chevron {
  background: transparent;
  border: 0;
  color: var(--text-soft);
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 8px;
  cursor: pointer;
}
.mcp-chevron svg { width: 18px; height: 18px; }
.mcp-body { padding: 0; }

/* ARB thumb */
.arb-thumb {
  position: relative;
  border-bottom: 1px solid var(--line-soft);
}
.arb-thumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 12 / 7.2;
  object-fit: cover;
  background: #1a3a5c;
}
.arb-url {
  position: absolute;
  bottom: 8px; left: 8px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: "SF Mono", "Menlo", monospace;
}

/* Scoring (in-progress) */
.arb-scoring { padding: 16px 14px 14px; }
.scoring-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-warm);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.scoring-title::before {
  content: "";
  width: 14px; height: 14px;
  border: 2px solid var(--arb-indigo);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.scoring-bar {
  height: 6px;
  background: var(--line-soft);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}
.scoring-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--arb-indigo), var(--arb-orange));
  transition: width 0.4s ease;
}
.scoring-checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.scoring-checks li {
  font-size: 12.5px;
  color: var(--text-mid);
  padding: 6px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: flex; justify-content: space-between; align-items: center;
}
.scoring-checks li::after {
  content: "…";
  color: var(--text-soft);
  font-weight: 700;
}
.scoring-checks li.done {
  color: var(--text-warm);
  border-style: solid;
  border-color: rgba(34, 192, 164, 0.4);
  background: rgba(34, 192, 164, 0.06);
}
.scoring-checks li.done::after {
  content: "✓";
  color: var(--arb-teal);
  font-weight: 700;
}

/* Internal scroll for ARB card body when result has the predict section */
.mcp-card.arb .mcp-body {
  max-height: 480px;
  overflow-y: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
.mcp-card.arb .mcp-body::-webkit-scrollbar { width: 4px; }
.mcp-card.arb .mcp-body::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }
.mcp-card.arb .mcp-body::-webkit-scrollbar-track { background: transparent; }

/* Result */
.arb-result { padding: 16px 14px 16px; }
.arb-result-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-warm);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.arb-result-title::before {
  content: "✓";
  color: var(--arb-teal);
  font-weight: 800;
}
.arb-score-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}
.donut { width: 96px; height: 96px; }
.score-num { line-height: 1; }
.score-big { font-size: 38px; font-weight: 800; color: var(--text-warm); letter-spacing: -0.02em; }
.score-small { font-size: 16px; color: var(--text-soft); margin-left: 4px; }
.score-cap { font-size: 12px; color: var(--text-soft); margin-top: 6px; }
.cat-bars {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 14px;
  padding-top: 6px;
  border-top: 1px solid var(--line-soft);
}
.cat {
  display: grid;
  grid-template-columns: 22px 90px 1fr 32px;
  gap: 8px;
  align-items: center;
  padding-top: 6px;
}
.cat-ico { font-size: 14px; }
.cat-label { font-size: 12.5px; color: var(--text-mid); }
.cat-bar {
  height: 8px;
  background: var(--line-soft);
  border-radius: 4px;
  overflow: hidden;
}
.cat-fill {
  height: 100%;
  width: var(--v);
  background: var(--c, var(--arb-indigo));
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.cat-val {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-warm);
  text-align: right;
}
.issue-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}
.issues {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.issues li {
  display: grid;
  grid-template-columns: 22px 1fr 14px;
  gap: 8px;
  align-items: center;
  padding: 8px 4px;
  font-size: 12.5px;
  color: var(--text-warm);
  border-bottom: 1px solid var(--line-soft);
}
.issues li:last-child { border-bottom: 0; }

/* === ARB prediction section === */
.predict-section {
  margin-top: 18px;
  padding: 16px 14px 18px;
  margin-left: -14px;
  margin-right: -14px;
  background: linear-gradient(180deg, #f3efff 0%, #fff7f0 100%);
  border-top: 1px solid rgba(74, 95, 217, 0.12);
}
.predict-divider {
  text-align: center;
  margin-bottom: 14px;
  position: relative;
}
.predict-divider::before, .predict-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 28%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(74, 95, 217, 0.35), transparent);
}
.predict-divider::before { left: 0; }
.predict-divider::after { right: 0; }
.predict-divider-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: var(--arb-indigo);
  background: white;
  border: 1px solid rgba(74, 95, 217, 0.25);
  padding: 4px 12px;
  border-radius: 999px;
  letter-spacing: 0.08em;
}
.predict-divider-label::before { content: "🚀 "; }

.predict-total {
  display: grid;
  grid-template-columns: 1fr 28px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(60, 42, 20, 0.04);
  margin-bottom: 14px;
}
.predict-col { text-align: center; }
.predict-cap { font-size: 10.5px; color: var(--text-soft); margin-bottom: 2px; letter-spacing: 0.05em; }
.predict-score { font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.predict-score.now { color: var(--text-mid); }
.predict-score.after { color: var(--arb-indigo); }
.predict-col.after .predict-cap { color: var(--arb-indigo); font-weight: 700; }
.predict-arrow { display: grid; place-items: center; }
.predict-arrow svg { width: 24px; height: 12px; }
.predict-gain {
  font-size: 14px;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, var(--arb-teal), #2ad6b3);
  padding: 4px 9px;
  border-radius: 999px;
  letter-spacing: -0.01em;
}

.predict-cats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.predict-cat {
  display: grid;
  grid-template-columns: 78px 1fr 26px 12px 26px 36px;
  gap: 6px;
  align-items: center;
  font-size: 11.5px;
  padding: 6px 0;
}
.pc-label { color: var(--text-mid); font-weight: 600; }
.pc-bar {
  position: relative;
  height: 8px;
  background: var(--line-soft);
  border-radius: 4px;
  overflow: hidden;
}
.pc-now {
  position: absolute; inset: 0;
  width: var(--v);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 4px;
}
.pc-after {
  position: absolute; inset: 0;
  width: var(--v);
  background: linear-gradient(90deg, var(--arb-indigo), var(--arb-teal));
  border-radius: 4px;
  opacity: 0;
  animation: pc-rise 1.4s 0.3s ease-out forwards;
}
@keyframes pc-rise {
  from { opacity: 0; transform: scaleX(0); transform-origin: left; }
  to   { opacity: 1; transform: scaleX(1); }
}
.pc-now-v { color: var(--text-soft); text-align: right; }
.pc-arrow { color: var(--text-soft); text-align: center; }
.pc-after-v { color: var(--arb-indigo); font-weight: 700; text-align: right; }
.pc-delta {
  text-align: right;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--arb-teal);
}

.improve-title, .impact-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 14px 0 8px;
}
.improvements {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px;
  background: white;
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(74, 95, 217, 0.1);
}
.improvements li {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 6px;
  align-items: start;
  font-size: 12px;
  color: var(--text-warm);
  line-height: 1.45;
}
.imp-ico {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--arb-teal);
  color: white;
  font-size: 10px;
  font-weight: 800;
  display: grid; place-items: center;
  margin-top: 2px;
}

.impacts {
  list-style: none; margin: 0; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
  background: white;
  border-radius: 10px;
  border: 1px solid rgba(74, 95, 217, 0.1);
}
.impacts li {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-warm);
}
.imp-emoji { font-size: 16px; }
.imp-label { color: var(--text-mid); }
.imp-val {
  font-size: 15px;
  font-weight: 800;
  color: var(--arb-teal);
  letter-spacing: -0.01em;
}

.issue-ico {
  width: 22px; height: 22px;
  border-radius: 6px;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: white;
}
.issue-ico.warn { background: #e88a3a; }
.issue-ico.info { background: #4a8fd9; }
.issue-ico.note { background: #8a8a8a; }
.chev { color: var(--text-soft); }

/* Edit preview card */
.browser-frame {
  border-bottom: 1px solid var(--line-soft);
  background: #fff;
}
.browser-chrome {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: #eee5d3;
  border-bottom: 1px solid var(--line-soft);
}
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: #c9bfae; }
.dots i:nth-child(1) { background: #e07a6a; }
.dots i:nth-child(2) { background: #e0b86a; }
.dots i:nth-child(3) { background: #6abf90; }
.browser-url {
  flex: 1;
  background: white;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--text-mid);
  font-family: "SF Mono", "Menlo", monospace;
  text-align: center;
}
.site-iframe {
  width: 100%;
  height: 520px;
  border: 0;
  background: white;
  display: block;
}
.edit-options { padding: 12px 14px 14px; }
.edit-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.edit-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: white;
  border: 1px solid var(--line);
  color: var(--text-warm);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
}
.chip::before {
  content: "›";
  color: var(--arb-indigo);
  font-weight: 700;
  font-size: 13px;
  line-height: 0;
}
.chip:hover {
  background: rgba(74, 95, 217, 0.06);
  border-color: rgba(74, 95, 217, 0.3);
}
.chip:active { transform: scale(0.97); }
.chip.selected {
  background: rgba(74, 95, 217, 0.12);
  border-color: var(--arb-indigo);
  color: var(--arb-indigo);
}
.chip.selected::before { color: var(--arb-indigo); }

/* Blog card */
.blog-progress { padding: 18px 14px; text-align: center; }
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--arb-indigo);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 8px;
}
.blog-progress-title { font-weight: 700; font-size: 14px; color: var(--text-warm); }
.blog-progress-sub { font-size: 12px; color: var(--text-soft); margin-top: 2px; margin-bottom: 12px; }
.blog-log {
  list-style: none;
  margin: 0;
  padding: 10px 12px;
  text-align: left;
  background: #f7f1e3;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  font-family: "SF Mono", "Menlo", monospace;
  font-size: 11px;
  color: var(--text-mid);
  min-height: 80px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.blog-log li.success { color: #2c8a6e; }
.blog-log li.active::before {
  content: "▸ ";
  color: var(--arb-indigo);
  font-weight: 700;
}
.blog-log li.success::before {
  content: "✓ ";
  font-weight: 700;
}

.blog-result { padding: 14px 14px 14px; }
.blog-result-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-warm);
  margin-bottom: 10px;
}
.article-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.article {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  background: var(--bg-cream-soft);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  overflow: hidden;
  animation: cardIn 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.article img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  background: #ccc;
}
.article-body { padding: 8px 10px 8px 0; display: flex; flex-direction: column; gap: 3px; }
.article-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--arb-indigo);
  background: rgba(74, 95, 217, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  width: fit-content;
}
.article-headline {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-warm);
  line-height: 1.35;
}
.article-meta { font-size: 10.5px; color: var(--text-soft); margin-top: auto; }

/* === Composer === */
.composer {
  display: grid;
  grid-template-columns: 36px 36px 1fr 40px;
  align-items: flex-end;
  gap: 6px;
  padding: 10px 12px 10px;
  border-top: 1px solid var(--line-soft);
  background: var(--bg-cream);
  min-height: 60px;
}
.comp-btn {
  width: 36px; height: 36px;
  border: 0;
  background: transparent;
  color: var(--text-mid);
  display: grid; place-items: center;
  border-radius: 50%;
  cursor: pointer;
}
.comp-btn svg { width: 18px; height: 18px; }
.comp-input {
  min-height: 36px;
  max-height: 168px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px 14px;
  display: flex; align-items: center;
  font-size: 13.5px;
  color: var(--text-warm);
  position: relative;
  overflow-y: auto;
  transition: max-height 0.2s ease;
}
.comp-placeholder {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.4;
}
.comp-placeholder.idle { color: var(--text-soft); }
.comp-caret {
  display: inline-block;
  width: 1.5px;
  height: 16px;
  background: var(--coral);
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: caret 1s steps(2) infinite;
  opacity: 0;
}
.comp-caret.on { opacity: 1; }
@keyframes caret { 50% { opacity: 0; } }
.comp-send {
  width: 36px; height: 36px;
  background: var(--coral);
  border: 0;
  border-radius: 50%;
  color: white;
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  opacity: 0.45;
  align-self: flex-end;
}
.comp-send.active {
  opacity: 1;
  background: var(--coral);
  cursor: pointer;
  animation: sendReady 1.6s ease-in-out infinite;
}
@keyframes sendReady {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 87, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(217, 119, 87, 0); }
}
.comp-send.active.firing {
  transform: scale(0.88);
  animation: none;
}
.comp-send:not(.active) { cursor: default; pointer-events: none; }
.comp-send svg { width: 18px; height: 18px; }

/* === Article viewer (slides up from bottom inside phone) === */
.article-viewer {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: 44px 1fr;
  pointer-events: auto;
}
.article-viewer[hidden] { display: none; }
.av-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 7, 0.45);
  animation: fadeBackdrop 0.25s ease forwards;
}
@keyframes fadeBackdrop { from { opacity: 0; } to { opacity: 1; } }

.av-sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  top: max(28px, env(safe-area-inset-top, 28px));
  background: white;
  border-radius: 18px 18px 0 0;
  display: grid;
  grid-template-rows: 48px 1fr;
  overflow: hidden;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.2);
  animation: slideUp 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.av-head {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  padding: 0 8px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.av-close, .av-action {
  width: 36px; height: 36px;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: var(--text-warm);
  cursor: pointer;
  display: grid; place-items: center;
}
.av-close:hover, .av-action:hover { background: rgba(0,0,0,0.05); }
.av-close svg, .av-action svg { width: 20px; height: 20px; }
.av-domain {
  font-family: "SF Mono", "Menlo", monospace;
  font-size: 11px;
  color: var(--text-soft);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.av-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: white;
}
.av-scroll::-webkit-scrollbar { width: 4px; }
.av-scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }

/* Naniwa Auto site header inside article viewer */
.nw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: white;
  border-bottom: 1px solid #e3e6ea;
}
.nw-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex: 0 1 auto;
  min-width: 0;
}
.nw-brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex: 0 0 36px;
}
.nw-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
}
.nw-brand-jp {
  font-size: 14px;
  font-weight: 900;
  color: var(--naniwa-navy);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.nw-brand-en {
  font-size: 9px;
  color: #98a0aa;
  letter-spacing: 0.2em;
  white-space: nowrap;
}
.nw-tel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--naniwa-navy);
  flex-shrink: 0;
}
.nw-tel-badge {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--naniwa-orange);
  color: white;
  font-size: 9px;
  font-weight: 800;
}
.nw-tel-num {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.nw-subnav {
  display: flex;
  gap: 0;
  background: white;
  border-bottom: 2px solid #e3e6ea;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nw-subnav::-webkit-scrollbar { display: none; }
.nw-subnav a {
  font-size: 12px;
  font-weight: 800;
  color: var(--naniwa-navy);
  text-decoration: none;
  padding: 10px 12px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.nw-subnav a.active {
  color: var(--naniwa-orange);
  border-bottom-color: var(--naniwa-orange);
}

.av-cover {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: #ddd;
}
.av-content { padding: 18px 18px 8px; }
.av-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--arb-indigo);
  background: rgba(74, 95, 217, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
}
.av-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text-warm);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.av-meta {
  font-size: 12px;
  color: var(--text-soft);
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 14px;
  margin-bottom: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.av-meta::before {
  content: "✍";
  margin-right: 4px;
}

.av-body { font-size: 14.5px; line-height: 1.85; color: var(--text-warm); }
.av-body p { margin: 0 0 14px; }
.av-body h2 {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-warm);
  margin: 24px 0 10px;
  padding-left: 10px;
  border-left: 3px solid var(--naniwa-orange);
  line-height: 1.4;
}
.av-body h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--naniwa-navy);
  margin: 18px 0 6px;
}
.av-body ol, .av-body ul {
  margin: 0 0 14px;
  padding-left: 22px;
}
.av-body ol li, .av-body ul li { margin-bottom: 4px; }
.av-body strong { color: var(--naniwa-navy); }
.av-body .callout {
  background: #fff7ee;
  border: 1px solid #f5d9b8;
  border-left: 4px solid var(--naniwa-orange);
  padding: 10px 14px;
  border-radius: 8px;
  margin: 16px 0;
  font-size: 13.5px;
}

.av-footer { padding: 14px 18px 28px; }
.av-cta-block {
  background: var(--naniwa-navy);
  color: white;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.av-cta-text { display: flex; flex-direction: column; gap: 3px; }
.av-cta-text strong { font-size: 14px; font-weight: 800; }
.av-cta-text span { font-size: 11px; opacity: 0.7; }
.av-cta-btn {
  background: var(--naniwa-orange);
  color: white;
  text-align: center;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

/* Naniwa Auto site footer inside article viewer */
.nw-footer {
  background: #0f1e2e; /* navy-900 */
  color: #d6dce4;
  padding: 22px 18px 14px;
  font-size: 12px;
  line-height: 1.6;
}
.nw-foot-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.nw-foot-brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.92;
}
.nw-foot-brand-jp {
  font-size: 14px;
  font-weight: 900;
  color: white;
  letter-spacing: 0.04em;
}
.nw-foot-brand-en {
  font-size: 9px;
  color: #98a0aa;
  letter-spacing: 0.2em;
}
.nw-foot-info {
  color: #b8c0cb;
  margin-bottom: 18px;
}
.nw-foot-info div { padding: 1px 0; }

.nw-foot-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
.nw-foot-cols h4 {
  font-size: 11px;
  font-weight: 800;
  color: white;
  border-left: 3px solid var(--naniwa-orange);
  padding-left: 6px;
  margin: 0 0 8px;
  line-height: 1.2;
}
.nw-foot-cols ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.nw-foot-cols a {
  color: #b8c0cb;
  text-decoration: none;
  font-size: 12px;
}
.nw-foot-cols a:hover { color: var(--naniwa-orange); }

.nw-foot-base {
  border-top: 1px solid #1f3247;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #889099;
  font-size: 10.5px;
}
.nw-foot-social {
  display: inline-flex;
  gap: 12px;
}
.nw-foot-social a {
  color: #b8c0cb;
  text-decoration: none;
  font-weight: 600;
}
.nw-foot-social a:hover { color: var(--naniwa-orange); }

/* Make article cards visibly clickable */
.article {
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.article:hover {
  border-color: rgba(74, 95, 217, 0.3);
  box-shadow: 0 2px 10px rgba(60, 42, 20, 0.08);
}
.article:active { transform: scale(0.985); }

/* === Home indicator === */
.home-indicator {
  display: grid;
  place-items: center;
}
.home-indicator::after {
  content: "";
  width: 134px;
  height: 5px;
  border-radius: 3px;
  background: var(--text-warm);
}

