:root {
  color-scheme: light;
  --ink: #18332d;
  --ink-soft: #557069;
  --paper: #f5f1e8;
  --surface: #fffdf8;
  --line: #dcd7ca;
  --accent: #f4c35a;
  --accent-deep: #dfaa35;
  --mint: #dceae4;
  --danger: #b75846;
  --shadow: 0 18px 50px rgba(24, 51, 45, 0.11);
  font-family: Inter, "SF Pro Display", "PingFang SC", "Apple SD Gothic Neo", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(244, 195, 90, 0.2), transparent 27rem),
    var(--paper);
}

.file-mode-notice {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  width: min(100%, 720px);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 auto 10px;
  padding: calc(9px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 4px solid #d8a900;
  border-radius: 0 0 16px 16px;
  background: #fff4cc;
  color: #705800;
  font-size: 11px;
}

.file-mode-notice strong,
.file-mode-notice span {
  display: block;
}

.file-mode-notice span {
  margin-top: 2px;
  color: #8d7319;
}

.file-mode-notice a {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--yellow);
  color: #5d4900;
  font-weight: 1000;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

.app-shell {
  width: min(100%, 680px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 20px calc(112px + env(safe-area-inset-bottom));
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: rise 280ms ease-out;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 5px 0 28px;
}

.topbar.compact {
  align-items: flex-end;
}

.eyebrow {
  margin: 0 0 7px;
  color: #9a7524;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 430px;
  margin-bottom: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(30px, 8vw, 46px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.round-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.7);
  font-weight: 800;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.api-button {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
  font-size: 11px;
}

.api-button.configured {
  border-color: #8ead9f;
  background: var(--mint);
  color: var(--ink);
}

.capture-card {
  overflow: hidden;
  border: 1px solid rgba(24, 51, 45, 0.11);
  border-radius: 28px;
  background: rgba(255, 253, 248, 0.85);
  box-shadow: var(--shadow);
}

.empty-state {
  padding: 48px 28px 38px;
  text-align: center;
}

.capture-icon {
  position: relative;
  width: 76px;
  height: 76px;
  margin: 0 auto 22px;
  border: 2px solid var(--ink);
  border-radius: 24px;
  transform: rotate(-3deg);
}

.capture-icon::before,
.capture-icon::after,
.capture-icon span::before,
.capture-icon span::after {
  position: absolute;
  width: 17px;
  height: 17px;
  border-color: var(--accent-deep);
  border-style: solid;
  content: "";
}

.capture-icon::before {
  top: 10px;
  left: 10px;
  border-width: 3px 0 0 3px;
}

.capture-icon::after {
  top: 10px;
  right: 10px;
  border-width: 3px 3px 0 0;
}

.capture-icon span::before {
  bottom: 10px;
  left: 10px;
  border-width: 0 0 3px 3px;
}

.capture-icon span::after {
  right: 10px;
  bottom: 10px;
  border-width: 0 3px 3px 0;
}

.empty-state h2 {
  margin-bottom: 8px;
  font-size: 22px;
}

.empty-state p,
.workspace-tip,
.analysis-loading p,
.notebook-empty p,
.review-placeholder p {
  color: var(--ink-soft);
  line-height: 1.65;
}

.primary-button,
.save-button {
  display: flex;
  width: 100%;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 17px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.empty-state .primary-button {
  max-width: 280px;
  margin: 26px auto 8px;
}

.text-button,
.replace-button {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.text-button {
  padding: 12px;
}

.selection-workspace {
  padding: 24px 18px 18px;
}

.workspace-head,
.word-card-top,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.workspace-head h2 {
  margin: 10px 0 0;
  font-size: 21px;
}

.step-pill {
  display: inline-block;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--mint);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.step-pill.warm {
  background: #f8e5b5;
}

.workspace-tip {
  margin: 12px 0 16px;
  font-size: 13px;
}

.image-stage {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  border-radius: 20px;
  background: #e5e0d6;
  touch-action: none;
  user-select: none;
}

.image-stage img {
  display: block;
  width: 100%;
  max-height: 510px;
  object-fit: contain;
  pointer-events: none;
}

.selection-box {
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: 9px;
  background: rgba(244, 195, 90, 0.23);
  box-shadow: 0 0 0 9999px rgba(24, 51, 45, 0.38);
  pointer-events: none;
}

.selection-box::before,
.selection-box::after {
  position: absolute;
  width: 13px;
  height: 13px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent-deep);
  content: "";
}

.selection-box::before {
  top: -8px;
  left: -8px;
}

.selection-box::after {
  right: -8px;
  bottom: -8px;
}

.analyze-button {
  justify-content: space-between;
  margin-top: 14px;
  padding: 0 22px;
}

.analyze-button:disabled {
  background: #a9b2ae;
  cursor: not-allowed;
}

.analysis-section {
  margin-top: 20px;
}

.analysis-loading {
  align-items: center;
  gap: 16px;
  padding: 22px;
  border-radius: 22px;
  background: var(--surface);
}

.loading-copy {
  min-width: 0;
  flex: 1;
}

.analysis-loading:not(.hidden) {
  display: flex;
}

.analysis-loading.ai-active {
  align-items: flex-start;
}

.analysis-loading.ai-active > .loader {
  display: none;
}

.ocr-confirm {
  padding: 24px 20px;
  border: 1px solid rgba(24, 51, 45, 0.11);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.ocr-confirm h2 {
  margin: 18px 0 7px;
  font-size: 22px;
}

.ocr-confirm p {
  margin-bottom: 16px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.ocr-confirm input {
  width: 100%;
  height: 64px;
  margin-bottom: 12px;
  padding: 0 17px;
  border: 2px solid var(--accent-deep);
  border-radius: 17px;
  outline: 0;
  background: #fffdf8;
  color: var(--ink);
  font-size: 26px;
  font-weight: 800;
}

.ocr-confirm small {
  display: block;
  margin-top: 13px;
  color: var(--ink-soft);
  line-height: 1.55;
  text-align: center;
}

.analysis-loading strong {
  display: block;
  margin-bottom: 4px;
}

.analysis-loading p {
  margin: 0;
  font-size: 13px;
}

.ocr-elapsed {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
  display: block;
}

.ai-progress {
  margin-top: 17px;
}

.ai-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--blue-deep);
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: 0.06em;
}

.ai-progress-head time {
  color: #71818a;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.ai-progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 99px;
  background: #cbeaf8;
}

.ai-progress-track i {
  display: block;
  width: 8%;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 500ms ease;
}

.ai-progress ol {
  display: grid;
  gap: 9px;
  margin: 15px 0 0;
  padding: 0;
  list-style: none;
}

.ai-progress li {
  position: relative;
  min-height: 18px;
  padding-left: 27px;
  color: #8a979e;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.45;
}

.ai-progress li::before {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 2px solid #c4d7e0;
  border-radius: 50%;
  background: white;
  content: "";
}

.ai-progress li.active {
  color: var(--ink);
}

.ai-progress li.active::before {
  border-color: var(--blue);
  border-top-color: transparent;
  animation: spin 800ms linear infinite;
}

.ai-progress li.done {
  color: #4b788e;
}

.ai-progress li.done::before {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
  content: "✓";
  font-size: 10px;
}

.loader {
  width: 28px;
  height: 28px;
  border: 3px solid var(--mint);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

.word-card {
  padding: 25px 20px 20px;
  border: 1px solid rgba(24, 51, 45, 0.11);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.context-label {
  margin: 20px 0 3px;
  color: var(--ink-soft);
  font-size: 12px;
}

.word-card h2 {
  margin-bottom: 2px;
  font-size: 38px;
  letter-spacing: -0.04em;
}

.pronunciation {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.crop-preview {
  width: 82px;
  height: 82px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 17px;
  background-color: var(--paper);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.meaning-block {
  margin: 24px 0 12px;
  padding: 19px;
  border-radius: 19px;
  background: var(--ink);
  color: white;
}

.meaning-block span {
  color: #bcd0c9;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.module-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.module-heading h3 {
  margin-bottom: 0;
}

.module-action {
  min-height: 32px;
  padding: 0 11px;
  flex: 0 0 auto;
  border: 1px solid rgba(24, 51, 45, 0.16);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.7);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.module-action.light {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.meaning-block strong {
  display: block;
  font-size: 21px;
}

.meaning-block p {
  margin: 7px 0 0;
  color: #dce7e3;
  font-size: 13px;
  line-height: 1.55;
}

.detail-grid {
  display: grid;
  gap: 10px;
}

.root-focus {
  margin: 12px 0;
  padding: 20px;
  border-radius: 21px;
  background: var(--mint);
}

.root-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 12px;
}

.root-head h3 {
  margin: 5px 0 0;
  font-size: 38px;
}

.root-head h3 small {
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 700;
}

.root-actions {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 8px;
}

.root-actions .module-action {
  min-height: 28px;
}

.root-meaning {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 900;
}

.root-focus p {
  margin: 0;
  color: #35504a;
  font-size: 14px;
  line-height: 1.7;
}

.detail-card,
.examples {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 19px;
}

.detail-card.memory-card {
  background: #fff7df;
  border-color: #efd99e;
}

.detail-number {
  color: #a0771d;
  font-family: Georgia, serif;
  font-size: 12px;
  font-style: italic;
}

.detail-card h3,
.examples h3 {
  margin: 5px 0 9px;
  font-size: 16px;
}

.detail-card p {
  margin-bottom: 0;
  color: #35504a;
  font-size: 14px;
  line-height: 1.68;
}

.detail-card small {
  display: block;
  margin-top: 10px;
  color: #8a7441;
  line-height: 1.5;
}

.breakdown-card {
  grid-column: 1 / -1;
}

.morpheme-list,
.sentence-breakdown {
  display: grid;
  gap: 7px;
}

.morpheme {
  display: grid;
  align-items: center;
  padding: 10px 0;
  grid-template-columns: minmax(55px, auto) minmax(75px, auto) 1fr;
  gap: 9px;
  border-top: 1px solid var(--line);
}

.morpheme b {
  font-size: 18px;
}

.morpheme span {
  color: #9a7524;
  font-size: 12px;
  font-weight: 800;
}

.morpheme small {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.45;
}

.examples {
  margin-top: 10px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.example-card {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.example-sentence {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.sound-button {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: var(--mint);
  font-size: 11px;
}

.example-sentence strong {
  display: block;
  font-size: 15px;
}

.example-sentence span {
  display: block;
  margin-top: 3px;
  color: #9a7524;
  font-size: 12px;
  font-weight: 700;
}

.example-sentence p {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.save-button {
  margin-top: 14px;
  background: var(--accent);
  color: var(--ink);
}

.draft-status {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px dashed #d3bb7a;
  border-radius: 17px;
  background: #fff9e9;
}

.draft-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent-deep);
}

.draft-status strong {
  display: block;
  font-size: 13px;
}

.draft-status p {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.save-button.saved {
  background: var(--mint);
}

.save-icon {
  font-size: 22px;
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  width: min(100%, 680px);
  margin: 0 auto;
  padding: 9px 24px calc(8px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid rgba(24, 51, 45, 0.1);
  background: rgba(255, 253, 248, 0.93);
  backdrop-filter: blur(18px);
}

.nav-item {
  display: flex;
  min-height: 53px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  border: 0;
  background: transparent;
  color: #7c8d88;
  font-size: 11px;
  font-weight: 700;
}

.nav-item.active {
  color: var(--ink);
}

.nav-icon {
  font-size: 21px;
  line-height: 1;
}

.word-count {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--mint);
  font-size: 12px;
  font-weight: 800;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.search-wrap input {
  width: 100%;
  height: 50px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.word-list {
  display: grid;
  gap: 10px;
}

.notebook-empty,
.review-placeholder {
  padding: 56px 25px;
  text-align: center;
}

.notebook-empty > span {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  margin: 0 auto 20px;
  border-radius: 25px;
  background: var(--mint);
  font-size: 29px;
  font-weight: 800;
  transform: rotate(4deg);
}

.notebook-empty h2,
.review-placeholder h2 {
  margin-bottom: 7px;
}

.notebook-empty .primary-button,
.review-placeholder .primary-button {
  max-width: 280px;
  margin: 24px auto 0;
}

.saved-word {
  display: grid;
  align-items: center;
  padding: 17px;
  grid-template-columns: 1fr auto;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--surface);
}

.saved-word h3 {
  margin: 0 0 4px;
  font-size: 21px;
}

.saved-word p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.delete-word {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #f2e9e3;
  color: var(--danger);
}

.review-ring {
  display: grid;
  width: 130px;
  height: 130px;
  place-items: center;
  margin: 10px auto 24px;
  border: 11px solid var(--mint);
  border-top-color: var(--accent);
  border-radius: 50%;
}

.review-ring span {
  font-family: Georgia, serif;
  font-size: 46px;
}

dialog {
  width: min(calc(100% - 36px), 420px);
  padding: 28px;
  border: 0;
  border-radius: 26px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(24, 51, 45, 0.55);
  backdrop-filter: blur(3px);
}

dialog h2 {
  margin: 17px 0 15px;
  font-family: Georgia, "Songti SC", serif;
  font-size: 27px;
}

dialog ol {
  margin: 0 0 24px;
  padding-left: 22px;
  color: var(--ink-soft);
  line-height: 1.8;
}

.module-dialog p {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.regen-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.regen-option {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.regen-option.selected {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.instruction-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 800;
}

.module-dialog textarea {
  width: 100%;
  min-height: 105px;
  padding: 13px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 15px;
  outline: 0;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  line-height: 1.55;
}

.api-key-input {
  width: 100%;
  height: 54px;
  margin-bottom: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  outline: 0;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.api-status {
  margin: 0 0 16px;
  font-size: 12px !important;
}

.dialog-actions {
  display: grid;
  gap: 9px;
  margin-top: 17px;
  grid-template-columns: 0.8fr 1.4fr;
}

.secondary-button {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  font-weight: 800;
}

.secondary-button:disabled {
  opacity: 0.4;
}

.dialog-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 35px;
  height: 35px;
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  font-size: 22px;
}

.toast {
  position: fixed;
  z-index: 50;
  bottom: calc(88px + env(safe-area-inset-bottom));
  left: 50%;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  transform: translate(-50%, 15px);
  transition: 220ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.hidden {
  display: none !important;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

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

@media (min-width: 620px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 2026 hybrid direction: green actions, blue analysis, purple collection */
:root {
  --ink: #263238;
  --ink-soft: #6f7b83;
  --paper: #f7f9fb;
  --surface: #ffffff;
  --line: #e3e8ec;
  --accent: #58cc02;
  --accent-deep: #46a302;
  --mint: #e5f8d5;
  --blue: #1cb0f6;
  --blue-deep: #168fc9;
  --blue-soft: #e9f7fe;
  --purple: #9069cd;
  --purple-deep: #7149a9;
  --purple-soft: #f3edff;
  --yellow: #ffc800;
  --shadow: 0 7px 0 #dce2e6;
  font-family: "SF Pro Rounded", "Arial Rounded MT Bold", Inter, "PingFang SC", "Apple SD Gothic Neo", sans-serif;
}

html,
body {
  background: var(--paper);
}

body {
  background:
    radial-gradient(circle at 50% -10rem, rgba(88, 204, 2, 0.13), transparent 27rem),
    var(--paper);
}

.app-shell {
  width: min(100%, 720px);
  padding: max(22px, env(safe-area-inset-top)) 18px calc(112px + env(safe-area-inset-bottom));
}

.topbar {
  align-items: center;
  margin: 4px 2px 22px;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--accent-deep);
  font-size: 11px;
  letter-spacing: 0.08em;
}

h1,
dialog h2 {
  font-family: inherit;
}

h1 {
  font-size: clamp(27px, 7vw, 36px);
  font-weight: 900;
  letter-spacing: -0.045em;
}

.round-button {
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  background: white;
  color: #839099;
  cursor: pointer;
}

.round-button:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
}

.api-button {
  border-color: #bde9fc;
  background: var(--blue-soft);
  color: var(--blue-deep);
}

.api-button.configured {
  border-color: #b8e98f;
  background: var(--mint);
  color: var(--accent-deep);
}

.lesson-progress {
  display: grid;
  align-items: center;
  gap: 11px;
  margin: 0 0 17px;
  padding: 12px 14px;
  grid-template-columns: 42px 1fr auto;
  border: 2px solid var(--line);
  border-bottom-width: 5px;
  border-radius: 18px;
  background: white;
}

.progress-mascot {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 13px;
  background: var(--accent);
  color: white;
  font-size: 19px;
  font-weight: 1000;
  box-shadow: 0 4px 0 var(--accent-deep);
}

.progress-copy > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.progress-copy span {
  color: #99a3aa;
  font-weight: 900;
}

.progress-track {
  overflow: hidden;
  height: 9px;
  margin-top: 7px;
  border-radius: 99px;
  background: #e9edf0;
}

.progress-track i {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.streak-chip {
  color: #ff4b4b;
  font-size: 12px;
  font-weight: 1000;
}

.capture-card,
.ocr-confirm,
.word-card {
  border: 2px solid var(--line);
  border-bottom-width: 6px;
  border-radius: 24px;
  background: white;
  box-shadow: none;
}

.empty-state {
  padding: 42px 24px 34px;
}

.capture-icon {
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 22px;
  background: var(--blue-soft);
  box-shadow: 0 6px 0 #c7eafb;
  transform: none;
}

.capture-icon::before,
.capture-icon::after,
.capture-icon span::before,
.capture-icon span::after {
  border-color: var(--blue);
}

.empty-state h2 {
  font-size: 23px;
  font-weight: 900;
}

.empty-state p,
.workspace-tip,
.analysis-loading p,
.notebook-empty p,
.review-placeholder p {
  color: var(--ink-soft);
}

.primary-button,
.save-button {
  min-height: 56px;
  border-radius: 16px;
  background: var(--accent);
  box-shadow: 0 5px 0 var(--accent-deep);
  color: white;
  font-weight: 1000;
  letter-spacing: 0.01em;
  transition: transform 120ms ease, box-shadow 120ms ease, background 180ms ease;
}

.primary-button:active,
.save-button:active {
  box-shadow: 0 2px 0 var(--accent-deep);
  transform: translateY(3px);
}

.text-button,
.replace-button {
  color: var(--blue-deep);
  font-weight: 900;
}

.step-pill {
  background: var(--blue-soft);
  color: var(--blue-deep);
}

.step-pill.warm {
  background: #fff4cc;
  color: #aa7e00;
}

.image-stage {
  border: 2px solid var(--line);
  background: #edf1f3;
}

.selection-box {
  border-color: var(--yellow);
  background: rgba(255, 200, 0, 0.22);
  box-shadow: 0 0 0 9999px rgba(38, 50, 56, 0.42);
}

.selection-box::before,
.selection-box::after {
  background: var(--yellow);
}

.analyze-button:disabled {
  box-shadow: 0 5px 0 #9da8ad;
  background: #b7c0c4;
}

.analysis-loading {
  border: 2px solid #bde9fc;
  border-bottom-width: 5px;
  background: var(--blue-soft);
}

.loader {
  border-color: #bde9fc;
  border-top-color: var(--blue);
}

.ocr-confirm input {
  border-color: var(--blue);
  background: white;
  color: var(--ink);
  box-shadow: inset 0 2px 0 rgba(28, 176, 246, 0.08);
}

.word-card {
  position: relative;
  overflow: hidden;
  padding: 0 18px 20px;
}

.analysis-mission {
  margin: 0 -18px 21px;
  padding: 18px 19px 16px;
  background: linear-gradient(145deg, #1899d6, var(--blue));
  color: white;
}

.analysis-mission > span {
  display: block;
  opacity: 0.8;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.analysis-mission > strong {
  display: block;
  margin: 4px 0 11px;
  font-size: 19px;
}

.mission-progress {
  display: grid;
  align-items: center;
  grid-template-columns: 1fr auto;
  gap: 9px;
}

.mission-progress i {
  position: relative;
  overflow: hidden;
  height: 9px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.28);
}

.mission-progress i::after {
  position: absolute;
  inset: 0;
  width: 100%;
  border-radius: inherit;
  background: white;
  content: "";
}

.mission-progress b {
  font-size: 10px;
}

.word-card h2 {
  font-size: 41px;
  font-weight: 1000;
}

.crop-preview {
  border: 2px solid #d9eef8;
  background-color: var(--blue-soft);
}

.meaning-block {
  margin-top: 19px;
  background: linear-gradient(145deg, #168fc9, var(--blue));
  box-shadow: 0 5px 0 #0d84bd;
}

.meaning-block span,
.meaning-block p {
  color: rgba(255, 255, 255, 0.8);
}

.module-action {
  border: 2px solid #dce2e6;
  border-bottom-width: 4px;
  background: white;
  color: #6d7880;
  font-weight: 900;
}

.module-action:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
}

.module-action.light {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.16);
}

.root-focus {
  border: 2px solid #9ddd68;
  border-bottom-width: 6px;
  background: #f1ffe7;
}

.root-head h3 {
  color: var(--accent-deep);
  font-weight: 1000;
}

.root-meaning {
  background: var(--mint);
  color: var(--accent-deep);
}

.detail-grid {
  counter-reset: analysis-task 1;
}

.detail-card,
.examples {
  position: relative;
  border: 2px solid var(--line);
  border-bottom-width: 5px;
  border-radius: 18px;
  background: white;
}

.detail-card::before,
.examples::before {
  position: absolute;
  top: 17px;
  left: -10px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  content: "✓";
  font-size: 11px;
  font-weight: 1000;
  box-shadow: 0 2px 0 var(--blue-deep);
}

.detail-card.memory-card {
  border-color: #ffd85b;
  background: #fffbec;
}

.detail-card.memory-card::before {
  background: var(--yellow);
  box-shadow: 0 2px 0 #d8a900;
  content: "★";
}

.detail-number {
  color: var(--blue-deep);
  font-family: inherit;
  font-style: normal;
  font-weight: 1000;
}

.morpheme {
  border-color: var(--line);
}

.morpheme span,
.example-sentence span {
  color: var(--blue-deep);
}

.sound-button {
  border: 2px solid #bde9fc;
  border-bottom-width: 4px;
  background: var(--blue-soft);
  color: var(--blue-deep);
}

.draft-status {
  border: 2px dashed #c9d1d6;
  background: #f7f9fa;
}

.draft-dot {
  background: var(--blue);
}

.collection-reveal {
  display: grid;
  align-items: center;
  gap: 11px;
  margin-top: 14px;
  padding: 14px;
  grid-template-columns: 42px 1fr auto;
  border: 2px solid #bda2e7;
  border-bottom-width: 6px;
  border-radius: 18px;
  background: linear-gradient(145deg, white, var(--purple-soft));
  color: #5f3b8f;
  animation: cardCollect 420ms cubic-bezier(0.2, 0.9, 0.3, 1.25);
}

.collection-spark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 13px;
  background: var(--purple);
  color: white;
  font-size: 21px;
  box-shadow: 0 4px 0 var(--purple-deep);
}

.collection-reveal small,
.collection-reveal strong,
.collection-reveal span {
  display: block;
}

.collection-reveal small {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.collection-reveal strong {
  margin: 2px 0;
  color: var(--ink);
  font-size: 18px;
}

.collection-reveal span {
  color: #8b76a4;
  font-size: 10px;
}

.collection-reveal > b {
  padding: 6px 8px;
  border-radius: 9px;
  background: #e8dcfa;
  font-size: 9px;
}

.save-button {
  background: var(--purple);
  box-shadow: 0 5px 0 var(--purple-deep);
}

.save-button:active {
  box-shadow: 0 2px 0 var(--purple-deep);
}

.save-button.saved {
  background: var(--purple);
}

.button-pop {
  animation: buttonPop 420ms ease;
}

.bottom-nav {
  border-top: 2px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.nav-item {
  color: #a1a9ae;
  font-weight: 900;
}

.nav-item.active {
  color: var(--accent-deep);
}

.nav-item.active .nav-icon {
  transform: translateY(-2px);
}

.collection-topbar .eyebrow {
  color: var(--purple);
}

.word-count {
  border: 2px solid #d8c8ef;
  background: var(--purple-soft);
  color: var(--purple-deep);
}

.search-wrap {
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  background: white;
}

.word-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.saved-word {
  position: relative;
  display: block;
  min-height: 205px;
  padding: 18px 16px;
  border: 2px solid #bda2e7;
  border-bottom-width: 7px;
  border-radius: 21px;
  background: linear-gradient(145deg, #fff, var(--purple-soft));
  text-align: center;
  cursor: pointer;
}

.saved-word-main {
  display: flex;
  align-items: center;
  flex-direction: column;
}

.card-rarity {
  color: var(--purple);
  font-size: 8px;
  font-weight: 1000;
  letter-spacing: 0.14em;
}

.saved-word h3 {
  margin: 19px 0 2px;
  color: #563681;
  font-size: 29px;
  font-weight: 1000;
}

.saved-reading {
  color: #9582ac;
  font-size: 10px;
  font-weight: 800;
}

.saved-word p {
  display: inline-block;
  margin-top: 13px;
  padding: 6px 10px;
  border-radius: 99px;
  background: var(--mint);
  color: #4d8509;
  font-size: 11px;
  font-weight: 900;
}

.mastery-label {
  position: absolute;
  right: 12px;
  bottom: 11px;
  left: 12px;
  padding-top: 8px;
  border-top: 1px solid #ddd0ef;
  color: var(--purple);
  font-size: 9px;
  font-weight: 900;
}

.delete-word {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 28px;
  height: 28px;
  background: #eee7f7;
  color: #9b85b5;
}

.notebook-empty > span {
  background: var(--purple-soft);
  color: var(--purple);
  box-shadow: 0 6px 0 #d8c8ef;
}

.review-ring {
  border-color: var(--mint);
  border-top-color: var(--accent);
}

dialog {
  border: 2px solid var(--line);
  border-bottom-width: 6px;
  border-radius: 23px;
  background: white;
  box-shadow: none;
}

dialog::backdrop {
  background: rgba(38, 50, 56, 0.62);
}

.regen-option {
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  background: white;
}

.regen-option.selected {
  border-color: var(--blue-deep);
  background: var(--blue);
}

.module-dialog textarea,
.api-key-input {
  border: 2px solid var(--line);
  background: #f7f9fa;
}

.secondary-button {
  border: 2px solid var(--line);
  border-bottom-width: 5px;
  background: white;
}

.toast {
  border-radius: 14px;
  background: #263238;
  box-shadow: 0 4px 0 #12191d;
}

@keyframes cardCollect {
  from {
    opacity: 0;
    transform: translateY(15px) scale(0.94);
  }
}

@keyframes buttonPop {
  50% {
    transform: scale(1.035);
  }
}

@media (max-width: 480px) {
  .app-shell {
    padding-right: 14px;
    padding-left: 14px;
  }

  .lesson-progress {
    grid-template-columns: 38px 1fr auto;
    padding: 11px;
  }

  .progress-mascot {
    width: 36px;
    height: 36px;
  }

  .word-card {
    padding-right: 14px;
    padding-left: 14px;
  }

  .analysis-mission {
    margin-right: -14px;
    margin-left: -14px;
  }

  .word-card-top {
    align-items: center;
  }

  .crop-preview {
    width: 68px;
    height: 68px;
  }

  .morpheme {
    grid-template-columns: 50px 75px 1fr;
    gap: 6px;
  }

  .word-list {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

  .saved-word {
    min-height: 190px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .saved-word h3 {
    font-size: 25px;
  }

  .dialog-actions {
    grid-template-columns: 1fr;
  }
}
