:root {
  --text: #171322;
  --muted: #5a526a;
  --line: rgba(69, 37, 110, .14);
  --card: #ffffff;
  --brand: #45256e;
  --brand-strong: #371d59;
  --accent: #b83b6b;
  --accent-soft: #fff1f6;
  --good: #2f6f12;
  --good-soft: #edf8e9;
  --info-soft: #e8f3ff;
  --bg: #fbf9ff;
  --nav: #ffffff;
  --shadow: 0 1px 0 rgba(0, 0, 0, .02);
  --focus: 0 0 0 3px rgba(212, 83, 126, .24);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #f4f0fb;
    --muted: #cfc6dc;
    --line: rgba(255, 255, 255, .15);
    --card: #151022;
    --brand: #d9c9ff;
    --brand-strong: #241333;
    --accent: #ff8eb5;
    --accent-soft: rgba(255, 142, 181, .12);
    --good: #a8e98e;
    --good-soft: rgba(92, 168, 61, .16);
    --info-soft: rgba(79, 144, 208, .18);
    --bg: #0c0814;
    --nav: #100b19;
    --shadow: none;
    --focus: 0 0 0 3px rgba(255, 142, 181, .24);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea,
input {
  font: inherit;
}

button {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.skip {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip:focus {
  left: 16px;
  top: 16px;
  width: auto;
  height: auto;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  z-index: 9999;
  box-shadow: var(--focus);
}

nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}

@supports (backdrop-filter: blur(1px)) {
  nav {
    backdrop-filter: saturate(1.1) blur(6px);
    background: color-mix(in srgb, var(--nav) 85%, transparent);
  }
}

.nav-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand a {
  font-weight: 700;
  font-size: 18px;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
}

.nav-links {
  display: flex;
  gap: 18px;
  align-items: center;
  position: relative;
}

.nav-links a,
.nav-menu summary {
  font-weight: 600;
  color: var(--text);
  opacity: .92;
  padding: 10px;
  border-radius: 10px;
}

.nav-links a:hover,
.nav-menu summary:hover,
.legal a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.nav-links a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.nav-menu {
  position: relative;
}

.nav-menu summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  list-style: none;
}

.nav-menu summary::-webkit-details-marker {
  display: none;
}

.nav-menu summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}

.nav-menu[open] summary {
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, transparent);
  text-decoration: none;
}

.nav-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 90;
  min-width: 240px;
  padding: 8px;
  display: grid;
  gap: 2px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .12);
}

.nav-menu-panel a {
  display: flex;
  white-space: nowrap;
  text-decoration: none;
}

.nav-menu-panel a:hover,
.nav-menu-panel a[aria-current="page"] {
  text-decoration: none;
  background: color-mix(in srgb, var(--brand) 8%, transparent);
}

.brand a:focus-visible,
.nav-links a:focus-visible,
.nav-menu summary:focus-visible,
.store-badge:focus-visible,
.tool-button:focus-visible,
.mode-tab:focus-visible,
.icon-btn:focus-visible,
.legal a:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.tool-hero {
  padding: clamp(36px, 7vw, 64px) 0 clamp(52px, 8vw, 86px);
  background: linear-gradient(135deg, var(--brand-strong), #45256e 58%, #6d335f);
  color: #ffffff;
  overflow: hidden;
}

.eyebrow {
  margin: 0 0 12px;
  color: #ffd7e5;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tool-hero h1 {
  margin: 0;
  max-width: 800px;
  font-size: clamp(38px, 6vw, 64px);
  font-weight: 900;
  line-height: .98;
  letter-spacing: -.04em;
}

.tool-hero p:not(.eyebrow) {
  margin: 16px 0 0;
  max-width: 700px;
  color: #ded4f1;
  font-size: clamp(16px, 2vw, 19px);
}

.tool-section {
  margin-top: -42px;
  padding: 0 0 clamp(44px, 7vw, 72px);
}

.summarizer-card,
.result-card,
.app-download-panel,
.info-card,
.faq-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.summarizer-card {
  --input-box-height: clamp(250px, 25vw, 280px);

  padding: clamp(18px, 3vw, 28px);
  box-shadow: 0 16px 42px rgba(69, 37, 110, .13);
}

.mode-switch {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  margin-bottom: 22px;
  background: color-mix(in srgb, var(--brand) 8%, var(--card));
  border-radius: 14px;
}

.mode-tab {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 10px;
  padding: 0 22px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.mode-tab[aria-selected="true"] {
  color: var(--text);
  background: var(--card);
  box-shadow: 0 1px 5px rgba(0, 0, 0, .05);
}

.inline-icon {
  width: 20px;
  height: 20px;
  display: block;
  vertical-align: -.125em;
  flex: 0 0 auto;
}

.input-panel[hidden],
.result-card[hidden] {
  display: none;
}

.input-panel {
  height: var(--input-box-height);
}

.text-input {
  width: 100%;
  height: 100%;
  min-height: 100%;
  display: block;
  resize: none;
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line));
  border-radius: 12px;
  padding: 20px;
  background: color-mix(in srgb, var(--card) 96%, var(--bg));
  color: var(--text);
  line-height: 1.55;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.text-input::placeholder {
  color: color-mix(in srgb, var(--muted) 74%, transparent);
}

.dropzone {
  height: 100%;
  min-height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  border: 2px dashed color-mix(in srgb, var(--muted) 45%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--card) 92%, var(--bg));
  padding: 30px;
  overflow: auto;
  transition: border-color .15s ease, background .15s ease;
}

.dropzone-content {
  width: min(100%, 560px);
}

.dropzone.is-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  color: var(--muted);
}

.dropzone-icon svg {
  width: 42px;
  height: 42px;
  display: block;
}

.dropzone strong {
  display: block;
  font-size: 20px;
  color: var(--text);
}

.dropzone p {
  margin: 6px 0 18px;
  color: var(--muted);
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.input-meta,
.control-row,
.result-meta,
.action-row,
.status-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.input-meta {
  justify-content: flex-end;
  margin-top: 10px;
  color: var(--muted);
  font-weight: 700;
}

.limit-note {
  color: var(--brand);
}

.limit-note:not(:empty) {
  margin-right: auto;
}

.limit-note:empty {
  display: none;
}

.pdf-status {
  margin-top: 14px;
  color: var(--muted);
  font-weight: 700;
}

.pdf-status:empty {
  display: none;
}

.control-row {
  width: min(100%, 820px);
  display: grid;
  grid-template-columns: minmax(300px, 1fr) 170px;
  gap: clamp(44px, 6vw, 72px);
  align-items: end;
  justify-content: center;
  margin: 26px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.length-control {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.length-control-head {
  min-height: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.length-title {
  font-size: 20px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.length-control input[type="range"] {
  width: 100%;
  accent-color: var(--brand);
}

.range-labels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.range-labels span:nth-child(2) {
  text-align: center;
}

.range-labels span:nth-child(3) {
  text-align: right;
}

.length-output {
  min-width: 4ch;
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tool-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--line));
  border-radius: 12px;
  padding: 0 18px;
  background: var(--card);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.tool-button.primary {
  color: #ffffff;
  background: #45256e;
  border-color: transparent;
}

.control-row .tool-button.primary {
  width: 100%;
  max-width: 180px;
  justify-self: end;
}

.tool-button.primary:hover {
  background: #371d59;
}

.tool-button:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}

.tool-button:active {
  border-radius: 12px;
  background: color-mix(in srgb, var(--brand) 8%, var(--card));
}

.tool-button.primary:active {
  background: #371d59;
}

.tool-button.is-confirmed {
  border-color: color-mix(in srgb, var(--good) 42%, var(--line));
  background: color-mix(in srgb, var(--good) 12%, var(--card));
  color: color-mix(in srgb, var(--good) 72%, var(--text));
}

.tool-button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.listen-button {
  width: 128px;
  min-width: 128px;
}

#copyButton {
  width: 118px;
}

.listen-icon {
  display: none;
}

.listen-button[data-listen-state="idle"] .listen-icon-idle,
.listen-button[data-listen-state="loading"] .listen-icon-loading,
.listen-button[data-listen-state="playing"] .listen-icon-playing {
  display: block;
}

.spinner-icon {
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.status-row {
  margin-top: 16px;
  color: var(--muted);
  font-weight: 700;
}

.status-row:empty {
  display: none;
}

.result-card {
  margin-top: 24px;
  padding: clamp(18px, 3vw, 28px);
}

.limit-alert {
  width: 100%;
  margin-top: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border: 2px solid #f6c344;
  border-radius: 12px;
  background: rgba(246, 195, 68, .14);
  color: color-mix(in srgb, var(--text) 88%, #5f4300);
  font-weight: 800;
  line-height: 1.4;
  box-shadow: 0 8px 20px rgba(117, 78, 0, .08);
}

.limit-alert[hidden] {
  display: none;
}

.limit-alert-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #f6c344;
  color: #221500;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.limit-alert span:not(.limit-alert-icon) {
  flex: 1 1 220px;
}

.limit-alert a {
  margin-left: auto;
  padding: 8px 12px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #f6c344;
  color: #221500;
  font-weight: 900;
}

.result-limit-note {
  margin: 0 0 16px;
}

.saved-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--good);
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 900;
  line-height: 1.2;
}

.result-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
}

.keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0;
}

.keyword-list:empty {
  display: none;
}

.keyword {
  position: relative;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  min-height: 36px;
  padding: 7px 36px 7px 16px;
  background: var(--info-soft);
  color: color-mix(in srgb, var(--brand) 80%, #0058a3);
  font-weight: 800;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.keyword-remove {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: currentColor;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
  transition: opacity .15s ease, background .15s ease;
}

.keyword-remove svg {
  width: 14px;
  height: 14px;
  display: block;
}

.keyword:hover .keyword-remove,
.keyword:focus-within .keyword-remove {
  opacity: 1;
  pointer-events: auto;
}

.keyword-remove:hover {
  background: color-mix(in srgb, var(--brand) 20%, transparent);
}

.keyword-remove:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.summary-output {
  margin: 0;
  padding: clamp(18px, 3vw, 28px);
  border-radius: 12px;
  background: color-mix(in srgb, var(--card) 76%, #f1eee8);
  color: var(--text);
  font-size: clamp(18px, 2.5vw, 24px);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.tts-highlight {
  padding: 0 .08em;
  margin: 0 -.08em;
  border-radius: 4px;
  background: #ffeb3b;
  color: #111;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.action-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
  margin-top: 24px;
}

.action-row .tool-button {
  width: 100%;
  min-width: 0;
  min-height: 56px;
  height: 56px;
  padding: 0 14px;
}

.action-row .listen-button,
.action-row #copyButton {
  width: 100%;
  min-width: 0;
}

.app-download-panel {
  margin-top: 28px;
  padding: 22px 28px;
  background: color-mix(in srgb, var(--info-soft) 80%, var(--card));
  border-color: color-mix(in srgb, #4d9fec 35%, var(--line));
  text-align: center;
}

.app-download-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  grid-template-areas:
    "copy preview"
    "stores preview";
  align-items: center;
  gap: 18px 26px;
}

.app-download-copy {
  grid-area: copy;
  max-width: 880px;
  margin: 0 auto;
  color: color-mix(in srgb, var(--brand) 82%, #004280);
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1.45;
  font-weight: 800;
}

.app-preview-frame {
  grid-area: preview;
  width: 128px;
  justify-self: center;
  filter: drop-shadow(0 16px 24px rgba(20, 10, 32, .22));
}

.app-preview-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.store-row {
  grid-area: stores;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.store-badge {
  height: 56px;
  display: inline-flex;
  align-items: center;
  border-radius: 10px;
}

.store-badge img {
  height: 56px;
  width: auto;
}

.content-section {
  padding: 12px 0 clamp(44px, 7vw, 72px);
}

.section-head {
  margin-bottom: 22px;
}

.section-head h2 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(27px, 4vw, 40px);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -.03em;
}

.section-head p {
  max-width: 700px;
  margin: 12px 0 0;
  color: var(--muted);
}

.info-grid,
.faq-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.info-card,
.faq-item {
  padding: 18px;
}

.info-card h3,
.faq-item h3 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.25;
  color: var(--brand);
}

.info-card p,
.faq-item p {
  margin: 0;
  color: var(--muted);
}

footer {
  border-top: 1px solid var(--line);
  background: var(--nav);
  padding: 28px 0;
  text-align: center;
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.icon-btn {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text);
  background: transparent;
}

.icon-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  color: var(--brand);
}

.footer-email {
  display: inline-flex;
  border: 0;
  padding: 10px 0;
}

.legal {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

.legal a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  margin: 0 6px;
  padding: 6px 4px;
  border-radius: 8px;
  display: inline-block;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-color-scheme: dark) {
  .summarizer-card {
    box-shadow: 0 24px 70px rgba(0, 0, 0, .42);
  }

  .nav-menu-panel {
    box-shadow: 0 16px 34px rgba(0, 0, 0, .38);
  }

  .tool-button.primary {
    background: #7b315f;
  }

  .tool-button.primary:hover {
    background: #8c3b6f;
  }

  .limit-alert {
    border-color: #f6c344;
    background: rgba(246, 195, 68, .13);
    color: #fff1bd;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .18);
  }

  .limit-alert-icon,
  .limit-alert a {
    background: #f6c344;
    color: #221500;
  }
}

@media (max-width: 960px) {
  .nav-inner {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .nav-links {
    width: 100%;
    gap: 8px;
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 4px;
  }

  .nav-links a,
  .nav-menu summary {
    flex: 0 0 auto;
    padding: 8px;
    font-size: 14px;
    white-space: nowrap;
  }

  .nav-menu {
    position: static;
  }

  .nav-menu-panel {
    left: 20px;
    right: 20px;
    min-width: 0;
    width: calc(100vw - 40px);
  }

  .control-row {
    grid-template-columns: 1fr;
    gap: 18px;
    justify-content: stretch;
  }

  .control-row .tool-button.primary {
    justify-self: center;
  }

  .length-control {
    width: 100%;
  }

  .length-output {
    min-width: 0;
    text-align: right;
  }

  .app-download-inner {
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "preview"
      "stores";
    gap: 18px;
  }

  .info-grid,
  .faq-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 18px;
  }

  .tool-hero h1 {
    font-size: clamp(36px, 12vw, 52px);
  }

  .mode-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .mode-tab {
    padding: 0 12px;
    font-size: 16px;
  }

  .store-badge,
  .store-badge img {
    height: 50px;
  }

  .app-download-panel {
    padding: 20px;
  }

  .app-preview-frame {
    width: 120px;
  }

  .tool-button {
    width: 100%;
  }

  .action-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .action-row .tool-button {
    width: 100%;
  }
}
