/* ================= NAV EXTRAS ================= */
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-cta {
  text-decoration: none; font-size: 14px; padding: 10px 18px; border-radius: 999px;
  background: var(--ink); color: var(--bg); transition: background .3s, color .3s;
}
.nav-cta:hover { background: var(--ember); color: #fff; }

/* ================= STUDIO (word + sentence) ================= */
.studio {
  width: min(780px, 100%); margin-top: 40px; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 32px;
  padding: 10px; box-shadow: var(--shadow); position: relative;
  transition: border-color .3s;
}
.studio:focus-within { border-color: color-mix(in srgb, var(--ink) 35%, var(--line)); }
.studio-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 4px 4px 10px; }
.seg { position: relative; display: inline-flex; background: var(--bg-2); border-radius: 999px; padding: 4px; }
.seg button {
  position: relative; z-index: 1; border: 0; background: none; padding: 9px 18px; font-size: 14px; font-weight: 500;
  color: var(--ink-2); border-radius: 999px; transition: color .4s var(--ease);
}
.seg button[aria-selected="true"] { color: var(--bg); }
.seg-pill {
  position: absolute; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 999px; background: var(--ink);
  transition: transform .55s var(--ease), width .55s var(--ease);
}
.intensity {
  display: flex; align-items: center; gap: 4px; opacity: 0; pointer-events: none; transform: translateX(8px);
  transition: opacity .4s, transform .5s var(--ease);
}
.studio[data-mode="sentence"] .intensity { opacity: 1; pointer-events: auto; transform: none; }
.intensity .label { margin-right: 6px; font-size: 10px; }
.engine { display: none; }
.studio[data-mode="rephrase"] .intensity:not(.engine) { display: none; }
.studio[data-mode="rephrase"] .engine { display: flex; opacity: 1; pointer-events: auto; transform: none; }
.engine button { display: inline-flex; align-items: center; gap: 6px; }
.engine svg { width: 13px; height: 13px; color: var(--ember); fill: var(--ember); stroke: none; }

/* AI loading */
.rp-loading { display: flex; align-items: center; gap: 14px; margin-top: 30px; color: var(--muted); font-size: 15px; }
.rp-loading .orb { width: 12px; height: 12px; border-radius: 50%; background: var(--ember); animation: pulse 1.1s var(--ease) infinite; }
@keyframes pulse { 0%, 100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1.15); opacity: 1; } }
.shimmer { height: clamp(48px, 8vw, 96px); margin-top: 18px; border-radius: 14px; width: 62%;
  background: linear-gradient(90deg, var(--bg-2) 0%, color-mix(in srgb, var(--bg-2) 40%, var(--card)) 50%, var(--bg-2) 100%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.rp-alts { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.rp-alts button {
  font-family: var(--serif); font-size: 21px; color: var(--ink); background: none; border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 14px; transition: border-color .25s, color .25s;
}
.rp-alts button:hover { border-color: var(--ember); color: var(--ember); }
.rp-note { margin: 14px 0 0; font-size: 13px; color: var(--muted); }

/* side-by-side: AI vs without AI */
.rp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 24px; }
.rp-col {
  border: 1px solid var(--line); border-radius: 22px; padding: 20px 22px 22px; background: var(--bg);
  min-width: 0; transition: border-color .4s, box-shadow .4s;
}
.rp-col.win { border-color: var(--ember); box-shadow: 0 0 0 1px var(--ember) inset; }
.rp-col-head { display: flex; justify-content: space-between; align-items: center; min-height: 24px; }
.rp-col-head .label { display: inline-flex; align-items: center; gap: 6px; }
.rp-col-head svg { width: 12px; height: 12px; fill: var(--ember); stroke: none; }
.win-tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: #fff; background: var(--ember); border-radius: 999px; padding: 4px 10px; opacity: 0; transform: scale(.9);
  transition: opacity .4s, transform .5s var(--ease);
}
.rp-col.win .win-tag { opacity: 1; transform: none; }
.rp-col .rp-after { font-size: clamp(34px, 4.6vw, 60px); margin-top: 14px; }
.rp-col.go .rp-after .ch { opacity: 1; transform: none; filter: none; }
.rp-col .rp-loading { margin-top: 18px; }
.rp-col .shimmer { width: 80%; height: 54px; }
.rp-meta { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.rp-meta b { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1; color: var(--ember); }
.rp-meta span { font-size: 13px; color: var(--muted); }
.rp-meta .copy-btn { margin-left: auto; }
.rp-col .rp-alts button { font-size: 18px; }
.rp-col .rp-steps { margin-top: 20px; padding-top: 14px; }
.rp-col .rp-steps ol { margin-top: 8px; }
.rp-col .rp-steps li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 7px 0; }
.rp-col .rp-steps li::before { content: none; }
.rp-col .rp-steps .to { font-size: 18px; }
.rp-col .rp-steps .why { flex-basis: 100%; font-size: 12px; }
.rp-col.go .rp-steps li { opacity: 1; transform: none; }
@media (max-width: 760px) { .rp-grid { grid-template-columns: 1fr; } }
.intensity button {
  border: 1px solid transparent; background: none; border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--muted);
  transition: all .25s;
}
.intensity button:hover { color: var(--ink); }
.intensity button.on { border-color: var(--line); color: var(--ink); background: var(--bg); }

.studio .lookup { margin: 0; width: 100%; background: var(--bg); box-shadow: none; border-radius: 24px; }
.studio .lookup:focus-within { border-color: var(--line); }
.composer { display: none; }
.studio:not([data-mode="word"]) .lookup { display: none; }
.studio:not([data-mode="word"]) .composer { display: block; animation: rise .5s var(--ease) both; }
.mode-note { margin: 0; padding: 2px 14px 12px; font-size: 13px; color: var(--muted); }
.studio:not([data-mode="rephrase"]) .mode-note { display: none; }

/* ================= REPHRASE RESULT ================= */
.rp-before {
  margin: 26px 0 0; font-family: var(--serif); font-size: clamp(20px, 2.4vw, 26px); line-height: 1.25; color: var(--muted);
  background: linear-gradient(var(--ember), var(--ember)) no-repeat 0 55% / 0% 1.5px;
  display: inline; transition: background-size 1s var(--ease);
}
.rp-card.go .rp-before { background-size: 100% 1.5px; }
.rp-after {
  margin: 18px 0 0; font-family: var(--serif); font-size: clamp(48px, 8vw, 104px); line-height: 1; letter-spacing: -.03em;
  overflow-wrap: break-word;
}
.rp-after .ch { display: inline-block; opacity: 0; transform: translateY(.35em); filter: blur(6px); transition: opacity .5s var(--ease), transform .7s var(--ease), filter .5s; white-space: pre; }
.rp-card.go .rp-after .ch { opacity: 1; transform: none; filter: none; }
.rp-after .p { color: var(--ember); }
.rp-steps { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 20px; }
.rp-steps ol { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 2px; counter-reset: step; }
.rp-steps li {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) 20px minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; align-items: baseline;
  padding: 10px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); counter-increment: step;
  opacity: 0; transform: translateY(8px); transition: opacity .5s var(--ease), transform .6s var(--ease);
}
.rp-card.go .rp-steps li { opacity: 1; transform: none; }
.rp-steps li::before { content: counter(step, decimal-leading-zero); font-family: var(--mono); font-size: 10px; color: var(--muted); }
.rp-steps .from { font-family: var(--mono); font-size: 13px; color: var(--ink-2); text-decoration: line-through; text-decoration-color: var(--ember); }
.rp-steps .arrow { color: var(--muted); font-size: 13px; }
.rp-steps .to { font-family: var(--serif); font-size: 21px; line-height: 1.1; color: var(--ember); }
.rp-steps .why { font-size: 13px; color: var(--muted); }
@media (max-width: 600px) {
  .rp-steps li { grid-template-columns: 24px auto 16px 1fr; }
  .rp-steps .why { grid-column: 2 / -1; }
}
.composer textarea {
  display: block; width: 100%; resize: none; border: 1px solid var(--line); outline: 0; border-radius: 24px;
  background: var(--bg); padding: 20px 24px; min-height: 132px; max-height: 340px;
  font-family: var(--serif); font-size: clamp(22px, 2.6vw, 30px); line-height: 1.25; letter-spacing: -.005em;
}
.composer textarea::placeholder { color: var(--muted); }
.composer-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 4px 2px 10px; }
.composer-hint { font-size: 12px; color: var(--muted); }
kbd {
  font-family: var(--mono); font-size: 10px; padding: 2px 6px; border-radius: 6px;
  border: 1px solid var(--line); border-bottom-width: 2px; color: var(--ink-2); background: var(--bg);
}

/* ================= SENTENCE RESULT ================= */
.sent-out {
  font-family: var(--serif); font-size: clamp(32px, 4.6vw, 58px); line-height: 1.16; letter-spacing: -.015em;
  margin: 28px 0 0; overflow-wrap: break-word;
}
.sent-out .w { display: inline-block; position: relative; white-space: nowrap; }
.sent-out .w::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: .02em; height: 2px; background: var(--ember);
  transform: scaleX(0); transform-origin: left; transition: transform .7s var(--ease) .3s;
}
.sent-out .w.coined::after { background: repeating-linear-gradient(90deg, var(--ember) 0 7px, transparent 7px 12px); }
.sent-out .w.go::after { transform: scaleX(1); }
.sent-out .w .c {
  display: inline-block; vertical-align: bottom; white-space: nowrap; color: var(--ember); font-style: italic;
  transition: max-width .85s var(--ease), opacity .55s var(--ease), transform .85s var(--ease), filter .55s;
}
.sent-out .w.go .c { max-width: 0 !important; opacity: 0; transform: translate(.15em, .3em) rotate(8deg); filter: blur(3px); }
.sent-out .w.resp { display: inline-grid; }
.sent-out .w.resp > span { grid-area: 1 / 1; transition: opacity .6s var(--ease), filter .6s, transform .7s var(--ease); }
.sent-out .w.resp .old { color: var(--ember); font-style: italic; }
.sent-out .w.resp .new { opacity: 0; filter: blur(6px); transform: translateY(.2em); }
.sent-out .w.resp.go .old { opacity: 0; filter: blur(6px); transform: translateY(-.2em); position: absolute; left: 0; }
.sent-out .w.resp.go .new { opacity: 1; filter: none; transform: none; }
.sent-out .w[title] { cursor: help; }

.sent-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 36px; border-top: 1px solid var(--line); }
.sent-stats div { padding: 18px 0 0; }
.sent-stats div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.sent-stats b {
  display: block; font-family: var(--serif); font-weight: 400; font-size: clamp(36px, 5vw, 56px);
  line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.sent-stats span { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.sent-foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; margin-top: 24px; }
.legend { display: flex; gap: 18px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 22px; height: 2px; background: var(--ember); vertical-align: middle; margin-right: 8px; }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--ember) 0 5px, transparent 5px 8px); }
.sent-orig { margin: 0; font-size: 14px; color: var(--muted); max-width: 520px; }
.sent-orig b {
  font-family: var(--mono); font-weight: 400; font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  margin-right: 8px; color: var(--ink-2);
}
.btn-row { display: flex; gap: 8px; }

/* ================= PHRASEBOOK ================= */
.phrasebook h2 em { color: var(--ember); }
.pb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); border-top: 1px solid var(--line); }
.pb-card {
  text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
  padding: 30px 26px 32px; display: flex; flex-direction: column; gap: 12px; transition: background .35s var(--ease);
}
.pb-card:hover, .pb-card:focus-visible { background: var(--card); outline: none; }
.pb-card .pb-dict { font-family: var(--serif); font-size: clamp(30px, 3vw, 38px); line-height: 1.1; letter-spacing: -.015em; color: var(--ink); }
.pb-card .pb-dict span { color: var(--ember); }
.pb-card .pb-full { font-size: 14px; color: var(--muted); }
.pb-card .pb-go {
  margin-top: auto; padding-top: 8px; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); display: inline-flex; align-items: center; gap: 8px; transition: color .25s;
}
.pb-card .pb-go svg { width: 14px; height: 14px; transition: transform .35s var(--ease); }
.pb-card:hover .pb-go { color: var(--ember); }
.pb-card:hover .pb-go svg { transform: translateX(4px); }
@media (max-width: 600px) { .pb-card { border-right: 0; padding: 24px 0 26px; } }

/* ================= CLOSING CTA ================= */
.cta-card {
  background: var(--ink); color: var(--bg); border-radius: 36px; text-align: center;
  padding: clamp(48px, 8vw, 110px) clamp(24px, 6vw, 80px); position: relative; overflow: hidden;
}
.cta-card::before {
  content: ""; position: absolute; width: 760px; height: 760px; left: 50%; bottom: -520px; transform: translateX(-50%);
  border-radius: 50%; background: radial-gradient(circle, rgba(226,84,28,.55), transparent 65%); pointer-events: none;
}
.cta-card > * { position: relative; }
.cta-card .label { color: color-mix(in srgb, var(--bg) 65%, transparent); }
.cta-card h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(48px, 8vw, 110px); line-height: .95; letter-spacing: -.03em; margin: 18px 0 0; }
.cta-card h2 em { color: var(--ember); }
.cta-before {
  margin: 40px 0 0; font-size: 16px; color: color-mix(in srgb, var(--bg) 50%, transparent);
  text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ember) 70%, transparent);
}
.cta-after { margin: 10px 0 0; font-family: var(--serif); font-size: clamp(28px, 4vw, 44px); line-height: 1.15; }
.cta-after span { color: var(--ember); border-bottom: 1.5px solid currentColor; }
.cta-btn { margin-top: 40px; text-decoration: none; background: var(--bg); color: var(--ink); padding: 16px 26px; }

@media (max-width: 900px) {
  .nav-cta { display: none; }
}
@media (max-width: 600px) {
  .studio { border-radius: 26px; padding: 8px; }
  .studio-bar { flex-direction: column; align-items: stretch; padding-bottom: 8px; }
  .seg { display: grid; grid-template-columns: repeat(3, 1fr); }
  .seg button { font-size: 13px; }
  .seg button { padding: 10px 8px; }
  .intensity { display: none; justify-content: center; }
  .studio[data-mode="sentence"] .intensity { display: flex; }
  .composer textarea { padding: 16px 18px; min-height: 120px; }
  .composer-hint { display: none; }
  .composer-foot { justify-content: flex-end; }
  .studio .composer .lookup-btn span { display: inline; }
  .sent-stats div + div { padding-left: 12px; }
  .sent-out { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .sent-out .w .c { display: none; }
}
