:root {
  --coral: #e85d4a;
  --coral-dark: #c44030;
  --bg: #f7f4f0;
  --bg2: #efeae3;
  --text: #1a1714;
  --text2: #6b6560;
  --text3: #a09890;
  --white: #ffffff;
  --select-color: rgba(232, 93, 74, 0.18);
  --select-border: rgba(232, 93, 74, 0.7);
  --bottom-nav: 64px;
  --app-max-width: 430px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  max-width: var(--app-max-width);
  margin: 0 auto;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "PingFang SC", system-ui, sans-serif;
  position: relative;
  user-select: none;
}

body.selection-dragging {
  overflow: hidden;
  touch-action: none;
}

.app-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 24% 18%, rgba(236, 246, 250, 0.78), transparent 32%),
    radial-gradient(circle at 72% 72%, rgba(53, 139, 186, 0.58), transparent 38%),
    linear-gradient(145deg, #dcebf0 0%, #9fc8d8 48%, #5da1c2 100%);
  color: #fff;
  opacity: 1;
  transition: opacity 0.42s ease, visibility 0.42s ease;
}

.app-splash::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0)),
    radial-gradient(circle at 50% 120%, rgba(255, 255, 255, 0.22), transparent 44%);
}

.app-splash.hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.app-splash-icon {
  position: relative;
  display: block;
  width: min(42vw, 164px);
  height: auto;
  border-radius: 22%;
  box-shadow: 0 18px 48px rgba(44, 99, 123, 0.24);
}

.app-splash-name {
  position: relative;
  margin-top: 18px;
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0;
  text-shadow: 0 2px 10px rgba(49, 93, 112, 0.28);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
}

.screen.active {
  display: flex;
}

.topbar,
.reader-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  background: var(--bg);
}

.topbar {
  justify-content: space-between;
  padding: 52px 20px 12px;
}

.search-bar {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.search-bar input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
}

.menu-button,
.back-button {
  border: 0;
  background: transparent;
  color: var(--text);
}

.menu-button {
  margin-left: 10px;
  padding: 8px;
}

.shelf-edit-button {
  min-width: 46px;
  border-radius: 16px;
  color: var(--coral);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.shelf-edit-button[aria-pressed="true"] {
  background: rgba(232, 93, 74, 0.1);
}

.shelf-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 16px 20px 100px;
}

.book-card {
  position: relative;
  border: 0;
  background: transparent;
  text-align: left;
}

.book-card.editing .book-cover {
  filter: brightness(0.92);
}

.book-delete-button {
  position: absolute;
  top: -8px;
  left: -8px;
  z-index: 4;
  display: flex;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: var(--coral);
  color: var(--white);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
}

.book-cover {
  display: flex;
  width: 100%;
  aspect-ratio: 3 / 4;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.book-cover-document {
  background: var(--white);
}

.book-cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-cover-icon {
  font-size: 30px;
}

.book-cover-title {
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.book-title {
  margin-top: 8px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
}

.book-author {
  color: var(--text3);
  font-size: 11px;
}

.reader-topbar {
  gap: 12px;
  padding: 52px 20px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.back-button {
  padding: 4px;
}

.reader-title {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
}

.reader-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 120px;
  -webkit-overflow-scrolling: touch;
}

.reader-text {
  color: var(--text);
  font-family: "Noto Serif KR", "AppleMyungjo", serif;
  font-size: 18px;
  line-height: 2;
}

.reader-text p {
  margin-bottom: 1.8em;
}

.pdf-page {
  position: relative;
  width: 100%;
  margin: 0 0 18px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--white);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.pdf-page-image {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.pdf-word-layer {
  position: absolute;
  z-index: 1;
  inset: 0;
}

.token {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  display: inline;
  border: 0;
  outline: 0;
  border-radius: 3px;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background 0.12s;
}

.token.known {
  color: var(--coral);
}

.token.selected {
  background: var(--select-color);
}

.token.mark-highlight {
  background: #ffe766 !important;
  border-radius: 2px;
}

.token.mark-underline {
  text-decoration: underline;
  text-decoration-color: var(--coral);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.token:focus,
.token:focus-visible,
.token:active {
  border: 0;
  outline: 0;
  box-shadow: none;
}

.token.selection-start {
  border-left: 0;
  box-shadow: inset 2px 0 0 var(--select-border);
}

.token.selection-end {
  border-right: 0;
  box-shadow: inset -2px 0 0 var(--select-border);
}

.token.selection-start.selection-end {
  box-shadow: inset 2px 0 0 var(--select-border), inset -2px 0 0 var(--select-border);
}

.token.pdf-token {
  position: absolute;
  z-index: 2;
  display: block;
  overflow: hidden;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: transparent !important;
  font-size: 1px;
  line-height: 1;
  text-decoration: none;
}

.token.pdf-token.selected,
.token.pdf-token.mark-highlight {
  background: rgba(255, 231, 102, 0.52) !important;
}

.token.pdf-token.selection-start,
.token.pdf-token.selection-end {
  border: 0;
}

.token.pdf-token.selection-start {
  box-shadow: inset 3px 0 0 var(--select-border);
}

.token.pdf-token.selection-end {
  box-shadow: inset -3px 0 0 var(--select-border);
}

.token.pdf-token.selection-start.selection-end {
  box-shadow: inset 3px 0 0 var(--select-border), inset -3px 0 0 var(--select-border);
}

.token.pdf-token.mark-underline::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 1px;
  left: 0;
  height: 2px;
  background: var(--coral);
}

.selection-handle {
  position: fixed;
  z-index: 70;
  display: none;
  width: 34px;
  height: 42px;
  border: 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
}

.selection-handle.visible {
  display: block;
}

.selection-handle::before {
  content: "";
  position: absolute;
  left: 50%;
  width: 3px;
  height: 28px;
  border-radius: 2px;
  background: var(--coral);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.86), 0 2px 7px rgba(0, 0, 0, 0.2);
  transform: translateX(-50%);
}

.selection-handle::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 22px;
  height: 22px;
  border: 3px solid var(--white);
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28);
  transform: translateX(-50%);
}

#handle-start {
  transform: translate(-50%, -34px);
}

#handle-start::before {
  top: 14px;
}

#handle-start::after {
  top: 0;
}

#handle-end {
  transform: translate(-50%, -8px);
}

#handle-end::before {
  top: 0;
}

#handle-end::after {
  bottom: 0;
}

.selection-toolbar {
  position: absolute;
  z-index: 60;
  display: none;
  align-items: center;
  gap: 0;
  max-width: calc(100vw - 16px);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 8px 8px;
  border-radius: 14px;
  margin-top: -8px;
  background: rgba(26, 23, 20, 0.92);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transform: translateX(-50%) translateY(-100%);
  white-space: nowrap;
}

.selection-toolbar::-webkit-scrollbar {
  display: none;
}

.selection-toolbar.visible {
  display: flex;
}

.selection-toolbar::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: var(--toolbar-arrow-left, 50%);
  border: 6px solid transparent;
  border-top-color: rgba(26, 23, 20, 0.92);
  border-bottom: 0;
  transform: translateX(-50%);
}

.toolbar-button {
  border: 0;
  border-radius: 6px;
  padding: 4px 10px;
  background: transparent;
  color: var(--white);
  font-size: 16px;
  font-weight: 600;
}

.toolbar-button.active {
  color: var(--coral);
}

.toolbar-separator {
  width: 1px;
  height: 18px;
  margin: 0 2px;
  background: rgba(255, 255, 255, 0.2);
}

.page-indicator {
  padding: 8px 20px;
  color: var(--text3);
  font-size: 12px;
  text-align: right;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 100;
  display: flex;
  width: 100%;
  max-width: var(--app-max-width);
  height: var(--bottom-nav);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--white);
  transform: translateX(-50%);
}

.nav-item {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--text3);
  font-size: 10px;
  transition: color 0.2s;
}

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

.dict-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
}

.dict-overlay.visible {
  display: block;
}

.dict-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.25);
}

.dict-sheet {
  position: absolute;
  bottom: 0;
  left: 50%;
  display: flex;
  width: 100%;
  max-width: var(--app-max-width);
  height: var(--dict-sheet-height, 40vh);
  max-height: 78vh;
  min-height: 28vh;
  overflow: hidden;
  flex-direction: column;
  border-radius: 24px 24px 0 0;
  background: var(--white);
  box-shadow: 0 -4px 40px rgba(0, 0, 0, 0.18);
  transform: translateX(-50%);
  animation: slide-up 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.dict-overlay.web-dict-compact .dict-sheet {
  height: var(--dict-sheet-height, 40vh);
  max-height: 78vh;
  min-height: 28vh;
}

.dict-overlay.web-dict-compact .dict-handle {
  margin-top: 8px;
}

.dict-overlay.web-dict-compact .dict-mode-tab {
  padding: 9px 4px;
}

.dict-overlay.web-dict-compact .action-row {
  padding: 6px 12px 5px;
}

.dict-overlay.web-dict-compact .add-word-button {
  padding: 6px 13px;
}

.dict-overlay.web-dict-compact .sheet-text-button {
  padding: 7px 10px;
}

.dict-overlay.web-dict-compact .dict-head {
  padding: 8px 12px 0;
}

.dict-overlay.web-dict-compact .dict-word {
  font-size: 22px;
}

.dict-overlay.web-dict-compact .dict-source,
.dict-overlay.web-dict-compact .dict-hanja {
  margin-bottom: 4px;
}

.dict-overlay.web-dict-compact .dict-scroll-hint {
  padding: 6px 0;
}

@keyframes slide-up {
  from {
    transform: translateX(-50%) translateY(100%);
  }
  to {
    transform: translateX(-50%) translateY(0);
  }
}

.dict-handle {
  width: 36px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: 2px;
  background: #e0dbd5;
  flex-shrink: 0;
}

.dict-sheet > .dict-handle {
  width: 48px;
  height: 18px;
  margin: 3px auto 0;
  background: transparent;
  cursor: ns-resize;
  touch-action: none;
}

.dict-sheet > .dict-handle::after {
  content: "";
  display: block;
  width: 48px;
  height: 5px;
  margin: 6px auto 0;
  border-radius: 999px;
  background: #e0dbd5;
}

.dict-mode-tabs {
  display: flex;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  background: var(--white);
}

.dict-mode-tab {
  position: relative;
  flex: 1;
  border: 0;
  padding: 9px 4px;
  background: transparent;
  color: var(--text3);
  font-size: 13px;
  font-weight: 500;
}

.dict-mode-tab.active {
  color: #E85D4A;
}

.dict-mode-tab.active::after {
  content: "";
  position: absolute;
  right: 15%;
  bottom: 0;
  left: 15%;
  height: 2px;
  border-radius: 1px;
  background: #E85D4A;
}

#panel-dict:not([hidden]),
#panel-translate:not([hidden]),
#panel-ask:not([hidden]) {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 5px;
  background: var(--white);
}

.add-word-button {
  border: 0;
  border-radius: 20px;
  padding: 6px 12px;
  background: var(--coral);
  color: var(--white);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.add-word-button.added {
  background: var(--text3);
}

.sheet-text-button {
  border: 0;
  border-radius: 17px;
  padding: 6px 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
}

.action-icon-button {
  display: flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 50%;
  background: var(--white);
  color: var(--text2);
}

.dict-body {
  flex: 1;
  overflow: hidden;
  padding: 0;
  background: var(--white);
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.dict-head {
  padding: 7px 12px 0;
  background: var(--white);
}

.dict-head-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}

.dict-head-main {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px;
}

.dict-word {
  color: var(--text);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.1;
}

.dict-roman {
  color: var(--text3);
  font-size: 11px;
  font-style: italic;
}

.dict-pos {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 6px;
  background: var(--bg);
  color: var(--text2);
  font-size: 10px;
  font-weight: 700;
  font-style: normal;
  letter-spacing: 0;
  text-transform: none;
}

.dict-speak-button {
  display: flex;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  align-items: center;
  justify-content: center;
  border: 0.5px solid var(--color-border-secondary, rgba(0, 0, 0, 0.12));
  border-radius: 50%;
  background: var(--white);
  color: var(--text2);
}

.dict-hanja {
  margin: 0 0 3px;
  color: var(--text3);
  font-size: 11px;
}

.dict-source {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  background: #FAECE7;
  color: #993C1D;
  font-size: 11px;
  font-weight: 700;
}

.dict-source-footer {
  margin: 0 0 4px 28px;
  padding-top: 2px;
}

.dict-senses-wrap {
  position: relative;
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  background: var(--white);
}

.dict-senses-scroll {
  display: grid;
  height: auto;
  min-height: 0;
  flex: 1;
  gap: 12px;
  overflow-y: auto;
  padding: 4px 14px;
  scrollbar-color: rgba(160, 152, 144, 0.75) transparent;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.dict-senses-scroll::-webkit-scrollbar {
  width: 5px;
}

.dict-senses-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.dict-senses-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(160, 152, 144, 0.72);
}

.dict-sense {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  overflow: visible;
}

.dict-sense-number {
  display: flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  margin: 1px 0 0;
  border-radius: 50%;
  background: var(--coral);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.dict-definition-wrap {
  min-width: 0;
  margin-left: 0;
}

.dict-definition-ko {
  margin: 0 0 3px;
  color: var(--text);
  font-size: 14px;
  font-weight: 450;
  line-height: 1.45;
}

.dict-definition-zh {
  margin-bottom: 7px;
  color: var(--text2);
  font-size: 13px;
  line-height: 1.5;
}

.dict-example {
  margin: 0 0 6px;
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--bg);
}

.dict-example .ko {
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
}

.dict-example .ko strong {
  color: var(--coral);
  font-weight: 850;
}

.dict-example .zh {
  margin-top: 3px;
  color: var(--text2);
  font-size: 12px;
  line-height: 1.45;
}

.dict-scroll-hint {
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  padding: 7px 14px 9px;
  background: var(--white);
  color: var(--text3);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

.dict-scroll-hint::before {
  content: "";
  margin-right: 0;
}

.translation-panel {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  background: var(--white);
  scrollbar-color: rgba(160, 152, 144, 0.75) transparent;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.translation-panel::-webkit-scrollbar {
  width: 5px;
}

.translation-panel::-webkit-scrollbar-track {
  background: transparent;
}

.translation-panel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(160, 152, 144, 0.72);
}

#panel-ask {
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.dict-overlay.web-dict-compact #panel-ask {
  flex: 1;
}

.translation-label {
  margin-bottom: 6px;
  color: var(--text3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.translation-original {
  margin-bottom: 10px;
  border-radius: 10px;
  padding: 9px 11px;
  background: var(--bg);
  font-family: "Noto Serif KR", serif;
  font-size: 13px;
  line-height: 1.6;
}

.translation-result {
  border-left: 3px solid var(--coral);
  border-radius: 10px;
  padding: 9px 11px;
  background: rgba(232, 93, 74, 0.06);
  font-size: 15px;
  line-height: 1.6;
}

.translation-source {
  margin-top: 8px;
  color: var(--text3);
  font-size: 11px;
  text-align: right;
}

.ask-panel {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  background: var(--white);
}

.ask-scroll {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 12px;
  scrollbar-color: rgba(232, 93, 74, 0.58) transparent;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.ask-scroll::-webkit-scrollbar {
  width: 5px;
}

.ask-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.ask-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(232, 93, 74, 0.58);
}

.ask-section-title {
  margin: 0 0 8px;
  color: var(--coral);
  font-size: 16px;
  font-weight: 800;
}

.ask-original {
  margin-bottom: 12px;
  border: 1px solid rgba(232, 93, 74, 0.1);
  background: var(--bg);
  font-size: 13px;
}

.ask-result {
  white-space: pre-wrap;
  border-left: 0;
  border-radius: 10px;
  padding: 0 0 8px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  line-height: 1.78;
}

.ask-answer-heading {
  margin: 15px 0 7px;
  color: var(--coral);
  font-size: 15px;
  font-weight: 750;
  line-height: 1.45;
}

.ask-answer-heading.translation {
  margin-top: 0;
}

.ask-answer-heading:first-child {
  margin-top: 0;
}

.ask-answer-line {
  margin: 0 0 7px;
}

.ask-answer-line strong {
  color: var(--text);
  font-weight: 800;
}

.ask-answer-spacer {
  height: 6px;
}

.ask-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
  align-items: center;
  border-top: 1px solid rgba(232, 93, 74, 0.1);
  border-radius: 16px 16px 0 0;
  padding: 6px 14px 10px;
  background: var(--bg);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.05);
}

.ask-composer .dict-handle {
  grid-column: 1 / -1;
  width: 30px;
  height: 3px;
  margin: 0 auto 2px;
  background: #e0dbd5;
}

.ask-input {
  width: 100%;
  min-height: 34px;
  max-height: 64px;
  resize: none;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 17px;
  padding: 7px 12px;
  background: var(--white);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
  outline: none;
}

.ask-input:focus {
  border-color: rgba(232, 93, 74, 0.45);
  background: var(--white);
}

.ask-submit {
  display: flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--coral);
  color: var(--white);
}

.ask-submit.secondary[hidden] {
  display: none;
}

.vocab-header,
.settings-header {
  padding: 52px 20px 16px;
  background: var(--bg);
}

.vocab-header h1,
.settings-header h1 {
  font-size: 22px;
  font-weight: 700;
}

.vocab-header span,
.settings-header span {
  color: var(--coral);
}

.vocab-header p {
  margin-top: 4px;
  color: var(--text2);
  font-size: 13px;
}

.web-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 52px 20px 12px;
  background: var(--bg);
}

.web-search {
  display: flex;
  gap: 8px;
}

.web-search input,
#web-browser-url {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  border-radius: 12px;
  padding: 11px 14px;
  background: var(--white);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  font-size: 14px;
}

.web-search button,
.web-text-button,
.web-bar-button {
  border: 0;
  border-radius: 12px;
  padding: 0 15px;
  background: var(--coral);
  color: var(--white);
  font-size: 14px;
  font-weight: 700;
}

.web-browser-bar {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px 34px;
  gap: 7px;
  align-items: center;
}

.web-browser-bar[hidden],
.web-nav-page[hidden],
.web-viewer[hidden],
.web-add-overlay[hidden] {
  display: none !important;
}

.web-bar-button {
  height: 34px;
  padding: 0;
  background: var(--white);
  color: var(--text2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  font-size: 17px;
}

.web-bar-button.favorite {
  color: var(--coral);
  font-size: 22px;
}

.web-bar-button.favorite.active,
.web-bar-button.translate.active {
  background: var(--coral);
  color: var(--white);
}

.web-bar-button.translate {
  color: var(--coral);
  font-size: 12px;
}

.web-body {
  padding: 0 0 100px;
}

.web-nav-page {
  position: relative;
  min-height: calc(100vh - 150px);
  padding: 0 0 80px;
}

.web-current {
  padding: 0 20px 12px;
  min-width: 0;
}

.web-title {
  overflow: hidden;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-url {
  overflow: hidden;
  margin-top: 2px;
  color: var(--text3);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-action-row {
  display: flex;
  gap: 8px;
  padding: 0 20px 10px;
  margin-bottom: 0;
}

.web-text-button {
  height: 36px;
}

.web-text-button.secondary {
  background: var(--white);
  color: var(--coral);
}

.web-frame-wrap {
  width: 100%;
  height: calc(100vh - 190px);
  margin-bottom: 12px;
  overflow-x: auto;
  overflow-y: auto;
  background: var(--bg);
  -webkit-overflow-scrolling: touch;
}

.web-original-frame {
  min-width: 100%;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: var(--bg);
  box-shadow: none;
}

.web-injected-layer {
  flex: 1;
  min-height: calc(100vh - 210px);
  max-height: calc(100vh - 210px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 20px 24px;
  background: var(--white);
  color: var(--text);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "PingFang SC", system-ui, sans-serif;
  line-height: 1.6;
  -webkit-overflow-scrolling: touch;
}

.web-injected-layer *,
.web-injected-layer *::before,
.web-injected-layer *::after {
  box-sizing: border-box;
  max-width: 100%;
}

.web-injected-layer > * {
  width: 100% !important;
  min-width: 0 !important;
}

.web-injected-layer div,
.web-injected-layer section,
.web-injected-layer article,
.web-injected-layer main,
.web-injected-layer ul,
.web-injected-layer ol,
.web-injected-layer li {
  min-width: 0 !important;
}

.web-injected-layer a {
  color: inherit;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.web-injected-layer img,
.web-injected-layer picture,
.web-injected-layer video {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.web-injected-layer picture,
.web-injected-layer img {
  position: static !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
}

.web-injected-layer picture {
  width: 100% !important;
  height: auto !important;
}

.web-injected-layer picture img {
  width: 100% !important;
  max-height: none !important;
  object-fit: contain !important;
}

.web-injected-layer a:has(img),
.web-injected-layer figure:has(img),
.web-injected-layer picture:has(img) {
  display: block !important;
  position: static !important;
  height: auto !important;
  min-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  overflow: visible !important;
}

.web-injected-layer h1,
.web-injected-layer h2,
.web-injected-layer h3 {
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.web-injected-layer p,
.web-injected-layer li {
  overflow-wrap: anywhere;
}

.web-injected-layer ul,
.web-injected-layer ol {
  padding-left: 1.2em;
}

.web-injected-layer li {
  margin: 0.2em 0;
}

.web-empty-state {
  display: grid;
  gap: 8px;
  padding: 36px 4px;
  color: var(--text2);
  font-size: 13px;
  line-height: 1.6;
}

.web-empty-state strong {
  color: var(--text);
  font-size: 16px;
}

.token[data-injected] {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: 2px;
}

.token[data-injected]:hover,
.token[data-injected].known {
  color: #E85D4A;
  background: rgba(232, 93, 74, 0.08);
}

.web-reader-text {
  padding: 0 20px;
  min-height: 180px;
  margin-bottom: 18px;
}

.web-site-section h2 {
  padding: 0 20px;
  margin: 16px 0 8px;
  color: var(--text3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.web-site-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: calc(100% - 40px);
  margin: 0 20px 8px;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--white);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  color: var(--text);
  text-align: left;
}

.web-site-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--bg2);
  color: var(--coral);
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 700;
  overflow: hidden;
}

.web-site-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.web-site-main {
  min-width: 0;
  flex: 1;
}

.web-site-name,
.web-site-url {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-site-name {
  font-size: 15px;
  font-weight: 700;
}

.web-site-url {
  margin-top: 2px;
  color: var(--text3);
  font-size: 12px;
}

.web-add-button {
  position: fixed;
  right: max(18px, calc(50% - 198px));
  bottom: 82px;
  z-index: 80;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: var(--coral);
  color: var(--white);
  box-shadow: 0 8px 22px rgba(232, 93, 74, 0.35);
  font-size: 30px;
  line-height: 1;
}

.web-add-overlay {
  position: fixed;
  inset: 0;
  z-index: 260;
}

.web-add-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.25);
}

.web-add-sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100%;
  max-width: var(--app-max-width);
  transform: translateX(-50%);
  border-radius: 22px 22px 0 0;
  padding: 0 18px 22px;
  background: var(--white);
  box-shadow: 0 -6px 34px rgba(0, 0, 0, 0.18);
}

.web-add-sheet h2 {
  margin: 14px 0 4px;
  font-size: 18px;
}

.web-add-sheet p {
  margin-bottom: 12px;
  color: var(--text3);
  font-size: 12px;
  line-height: 1.5;
}

.web-add-sheet input {
  width: 100%;
  border: 1px solid var(--bg2);
  border-radius: 12px;
  padding: 11px 12px;
  margin-bottom: 9px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.web-add-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.web-add-actions button {
  border: 0;
  border-radius: 12px;
  padding: 12px;
  background: var(--bg);
  color: var(--text2);
  font-size: 14px;
  font-weight: 700;
}

.web-add-actions button:last-child {
  background: #2f80ed;
  color: var(--white);
}

.vocab-list,
.settings-body {
  padding: 8px 20px 100px;
}

.vocab-export-bar {
  display: flex;
  gap: 8px;
  padding: 0 20px 8px;
}

.vocab-export-bar select,
.vocab-export-bar button {
  min-width: 0;
  border: 0;
  border-radius: 11px;
  padding: 9px 10px;
  background: var(--white);
  color: var(--text);
  font-size: 13px;
}

.vocab-export-bar select {
  flex: 1;
}

.vocab-export-bar button {
  background: var(--coral);
  color: var(--white);
  font-weight: 700;
}

.vocab-export-result {
  padding: 0 20px 8px;
}

.vocab-export-result a {
  display: block;
  border-radius: 11px;
  padding: 10px 12px;
  background: rgba(232, 93, 74, 0.1);
  color: var(--coral);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.notes-body {
  padding: 8px 20px 100px;
}

.notes-upload {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.notes-upload button {
  border: 0;
  border-radius: 12px;
  padding: 11px 10px;
  background: var(--white);
  color: var(--coral);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.notebook-list {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin-bottom: 12px;
}

.notebook-chip {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(232, 93, 74, 0.1);
  color: var(--coral);
  font-size: 12px;
  font-weight: 700;
}

.notebook-chip.active {
  background: var(--coral);
  color: var(--white);
}

.note-card {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  margin-bottom: 9px;
  border: 0;
  border-radius: 14px;
  padding: 10px;
  background: var(--white);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  text-align: left;
}

.note-card img,
.note-file-thumb {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg2);
}

.note-file-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  font-weight: 800;
}

.note-card strong,
.note-card span {
  display: block;
}

.note-card strong {
  margin-bottom: 4px;
  font-size: 14px;
}

.note-card span {
  color: var(--text3);
  font-size: 12px;
}

.note-detail {
  margin-bottom: 14px;
}

.note-back {
  margin-bottom: 10px;
  color: var(--coral);
  font-size: 15px;
}

.note-detail img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 10px;
  background: var(--white);
}

.note-scan {
  margin-top: 10px;
  border-radius: 12px;
  padding: 12px;
  background: var(--white);
  user-select: text;
  -webkit-user-select: text;
}

.note-scan h2 {
  margin-bottom: 8px;
  font-size: 16px;
}

.note-ai-button {
  border: 0;
  border-radius: 16px;
  padding: 7px 11px;
  margin-bottom: 10px;
  background: rgba(232, 93, 74, 0.1);
  color: var(--coral);
  font-size: 12px;
  font-weight: 700;
}

.note-detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.note-ai-button.secondary {
  background: var(--bg);
  color: var(--text2);
}

.note-selection-toolbar {
  position: fixed;
  z-index: 240;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -115%);
  border-radius: 12px;
  padding: 6px;
  background: rgba(26, 23, 20, 0.94);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.note-selection-toolbar button {
  border: 0;
  border-radius: 8px;
  padding: 7px 14px;
  background: transparent;
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
}

.note-notebook-overlay {
  position: fixed;
  inset: 0;
  z-index: 260;
}

.note-notebook-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.25);
}

.note-notebook-sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100%;
  max-width: var(--app-max-width);
  transform: translateX(-50%);
  border-radius: 22px 22px 0 0;
  padding: 0 18px 22px;
  background: var(--white);
  box-shadow: 0 -6px 34px rgba(0, 0, 0, 0.18);
}

.note-notebook-sheet h2 {
  margin: 14px 0 12px;
  font-size: 17px;
}

.note-notebook-choices {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.note-notebook-choice {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--bg);
  color: var(--text);
  text-align: left;
  font-size: 14px;
  font-weight: 700;
}

.note-notebook-choice.active {
  background: rgba(232, 93, 74, 0.12);
  color: var(--coral);
}

.note-create-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.note-create-box input {
  min-width: 0;
  border: 1px solid var(--bg2);
  border-radius: 12px;
  padding: 11px 12px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.note-create-box button {
  border: 0;
  border-radius: 12px;
  padding: 0 13px;
  background: var(--coral);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
}

.note-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 270;
}

.note-editor-sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100%;
  max-width: 430px;
  transform: translateX(-50%);
  border-radius: 22px 22px 0 0;
  padding: 0 18px 22px;
  background: var(--white);
  box-shadow: 0 -6px 34px rgba(0, 0, 0, 0.18);
}

.note-editor-sheet h2 {
  margin: 14px 0 12px;
  font-size: 17px;
}

.note-editor-sheet input,
.note-editor-sheet textarea {
  width: 100%;
  border: 1px solid var(--bg2);
  border-radius: 12px;
  padding: 11px 12px;
  margin-bottom: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  outline: none;
  resize: vertical;
}

.note-editor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.note-editor-actions button {
  border: 0;
  border-radius: 12px;
  padding: 12px;
  background: var(--bg);
  color: var(--text2);
  font-size: 14px;
  font-weight: 700;
}

.note-editor-actions button:last-child {
  background: var(--coral);
  color: var(--white);
}

.qa-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 52px 20px 12px;
  background: var(--bg);
}

.qa-header h1 {
  font-size: 22px;
  font-weight: 800;
}

.qa-notes-button,
.qa-image-button,
.qa-send-button {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
}

.qa-notes-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--white);
  color: var(--coral);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.qa-body {
  padding: 6px 16px 146px;
}

.qa-messages {
  display: grid;
  gap: 12px;
}

.qa-message {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.qa-message.user {
  justify-content: flex-end;
}

.qa-bot-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(232, 93, 74, 0.12);
  color: var(--coral);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
}

.qa-bubble {
  max-width: 78%;
  border-radius: 16px;
  padding: 11px 13px;
  background: var(--white);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.qa-message.user .qa-bubble {
  background: var(--coral);
  color: var(--white);
  border-bottom-right-radius: 5px;
}

.qa-message.ai .qa-bubble {
  border-bottom-left-radius: 5px;
}

.qa-bubble img {
  display: block;
  max-width: 160px;
  max-height: 160px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 7px;
}

.qa-input-bar {
  position: fixed;
  left: 50%;
  bottom: 64px;
  z-index: 90;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: end;
  width: 100%;
  max-width: var(--app-max-width);
  transform: translateX(-50%);
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.qa-image-preview {
  grid-column: 1 / -1;
  position: relative;
  width: 86px;
  height: 86px;
  margin-bottom: 2px;
}

.qa-image-preview[hidden] {
  display: none !important;
}

.qa-image-preview img {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  object-fit: cover;
  background: var(--bg2);
}

.qa-image-preview button {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(26, 23, 20, 0.84);
  color: var(--white);
  font-size: 16px;
}

.qa-image-button,
.qa-send-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.qa-image-button {
  background: var(--bg);
  color: var(--text2);
}

.qa-send-button {
  background: var(--coral);
  color: var(--white);
}

#qa-input {
  min-height: 42px;
  max-height: 96px;
  border: 0;
  border-radius: 18px;
  padding: 11px 13px;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
  outline: none;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
}

.study-notes-overlay {
  position: fixed;
  inset: 0;
  z-index: 280;
  background: var(--bg);
}

.study-notes-overlay[hidden] {
  display: none !important;
}

.study-notes-sheet {
  width: 100%;
  max-width: var(--app-max-width);
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: 28px;
  background: var(--bg);
}

.study-notes-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 52px 20px 12px;
}

.study-notes-header h1 {
  font-size: 21px;
}

.study-range-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 20px 12px;
}

.study-range-chips button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--white);
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
}

.study-range-chips button.active {
  background: var(--coral);
  color: var(--white);
}

.study-history-list {
  padding: 0 20px 12px;
}

.study-history-card {
  display: flex;
  gap: 10px;
  align-items: center;
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 8px;
  background: var(--white);
}

.study-history-card img {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
}

.study-history-card strong,
.study-history-card span {
  display: block;
}

.study-history-card strong {
  font-size: 13px;
}

.study-history-card span {
  margin-top: 3px;
  color: var(--text3);
  font-size: 11px;
}

.study-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 20px 12px;
}

.study-actions button {
  border: 0;
  border-radius: 12px;
  padding: 12px;
  background: var(--white);
  color: var(--text2);
  font-size: 14px;
  font-weight: 700;
}

.study-actions button:first-child {
  background: var(--coral);
  color: var(--white);
}

.study-summary {
  margin: 0 20px;
  border-radius: 12px;
  padding: 14px;
  background: var(--white);
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.7;
}

.vocab-empty {
  padding: 60px 20px;
  color: var(--text3);
  text-align: center;
}

.vocab-empty-icon {
  margin-bottom: 12px;
  font-size: 48px;
}

.vocab-item,
.settings-row {
  border-radius: 14px;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.vocab-item {
  display: flex;
  position: relative;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
  padding: 10px 12px;
}

.vocab-word {
  flex: 1;
  min-width: 0;
  padding-right: 46px;
}

.vocab-ko {
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.vocab-zh {
  margin-top: 2px;
  color: var(--text3);
  font-size: 12px;
}

.vocab-zh.visible {
  color: var(--text2);
}

.vocab-example {
  margin-top: 7px;
  border-radius: 8px;
  padding: 7px 9px;
  background: #F0F7F0;
  overflow-wrap: anywhere;
}

.vocab-example-ko {
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
}

.vocab-example-zh {
  margin-top: 2px;
  color: var(--text2);
  font-size: 11px;
  line-height: 1.45;
}

.muted {
  color: var(--text2);
  font-size: 12px;
}

.vocab-reveal {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 0;
  border-radius: 15px;
  background: rgba(232, 93, 74, 0.1);
  color: var(--coral);
  font-size: 12px;
  font-weight: 700;
}

.vocab-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 0;
  padding: 3px;
  background: transparent;
  color: var(--text3);
}

.vocab-speak {
  display: flex;
  position: absolute;
  top: 8px;
  right: 32px;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  background: var(--bg);
  color: var(--text2);
}

.settings-section {
  margin-bottom: 24px;
}

.settings-section h2 {
  margin-bottom: 8px;
  padding-left: 4px;
  color: var(--text3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  padding: 11px 14px;
}

.settings-action-row {
  width: 100%;
  border: 0;
  color: var(--text);
  text-align: left;
}

.settings-mail-row {
  text-decoration: none;
}

.settings-panel {
  margin: -2px 0 10px;
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.account-status {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.account-note {
  margin-top: 3px;
  color: var(--text3);
  font-size: 12px;
  line-height: 1.45;
}

.account-primary {
  flex: 0 0 auto;
  border: 0;
  border-radius: 18px;
  padding: 8px 12px;
  background: var(--coral);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
}

.account-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 9px;
  padding: 3px;
  border-radius: 12px;
  background: var(--bg2);
}

.account-mode {
  border: 0;
  border-radius: 9px;
  padding: 8px 6px;
  background: transparent;
  color: var(--text2);
  font-size: 13px;
  font-weight: 700;
}

.account-mode.active {
  background: var(--white);
  color: var(--coral);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.account-referral-input {
  margin-top: 8px;
}

.vip-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 9px;
}

.vip-plan {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 10px 8px;
  background: var(--white);
  color: var(--text);
  text-align: center;
}

.vip-plan.active {
  border-color: rgba(232, 93, 74, 0.55);
  background: rgba(232, 93, 74, 0.06);
}

.vip-plan span,
.vip-plan small {
  display: block;
  color: var(--text3);
  font-size: 11px;
}

.vip-plan strong {
  display: block;
  margin: 2px 0;
  color: var(--coral);
  font-size: 18px;
}

.vip-badge {
  position: absolute;
  top: 0;
  right: 0;
  border-radius: 0 12px 0 8px;
  padding: 2px 6px 3px;
  background: var(--coral);
  color: var(--white);
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
}

.account-benefits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 12px;
}

.account-benefits span {
  border-radius: 9px;
  padding: 7px 8px;
  background: rgba(232, 93, 74, 0.08);
  color: var(--coral);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.account-user {
  margin-top: 3px;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
}

.campaign-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.campaign-code {
  margin-top: 3px;
  color: var(--coral);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.campaign-progress {
  margin-bottom: 10px;
  color: var(--text2);
  font-size: 13px;
}

.campaign-progress strong {
  color: var(--coral);
}

.campaign-bar {
  height: 8px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg2);
}

.campaign-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--coral);
}

.settings-panel-text {
  margin-top: 8px;
  color: var(--text2);
  font-size: 12px;
  line-height: 1.6;
}

.feedback-input,
.feedback-textarea {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  outline: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.feedback-textarea {
  margin-top: 8px;
  resize: vertical;
}

.feedback-input:focus,
.feedback-textarea:focus {
  border-color: rgba(232, 93, 74, 0.45);
  background: var(--white);
}

.feedback-submit {
  width: 100%;
  height: 38px;
  margin-top: 9px;
  border: 0;
  border-radius: 19px;
  background: var(--coral);
  color: var(--white);
  font-weight: 700;
}

.account-restore-inline {
  width: 100%;
  height: 38px;
  margin-top: 8px;
  border: 1px solid rgba(232, 93, 74, 0.36);
  border-radius: 19px;
  background: var(--white);
  color: var(--coral);
  font-weight: 700;
}

.legal-links {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  color: var(--text3);
  font-size: 12px;
}

.legal-links a {
  color: var(--coral);
  text-decoration: none;
}

.danger-text-button {
  width: 100%;
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: #b94032;
  font-size: 12px;
  font-weight: 600;
}

.ai-credit-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 15px 16px;
  border-radius: 14px;
  background: var(--white);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.compact-ai-row .muted {
  font-size: 13px;
}

.compact-ai-panel {
  padding-top: 10px;
}

.compact-ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--text3);
  font-size: 12px;
}

.ai-credit-label,
.ai-credit-note {
  color: var(--text3);
  font-size: 12px;
}

.ai-credit-value {
  margin: 3px 0 2px;
  color: var(--text);
  font-size: 22px;
  font-weight: 700;
}

.ai-credit-help {
  flex: 0 0 auto;
  border: 0;
  border-radius: 17px;
  padding: 8px 12px;
  background: rgba(232, 93, 74, 0.1);
  color: var(--coral);
  font-size: 12px;
  font-weight: 700;
}

.ai-pack-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ai-pack {
  display: flex;
  min-height: 62px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  background: var(--white);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.035);
}

.ai-pack.active {
  border-color: rgba(232, 93, 74, 0.45);
  background: rgba(232, 93, 74, 0.06);
}

.ai-pack span {
  color: var(--text2);
  font-size: 11px;
}

.ai-pack strong {
  margin: 2px 0;
  color: var(--coral);
  font-size: 16px;
}

.ai-pack small {
  color: var(--text3);
  font-size: 11px;
}

.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  border: 0;
  border-radius: 13px;
  background: var(--bg2);
}

.toggle.on {
  background: var(--coral);
}

.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.toggle.on::after {
  transform: translateX(18px);
}

.font-buttons {
  display: flex;
  gap: 8px;
}

.font-button {
  display: flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--bg2);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
}

.font-button.active {
  border-color: var(--coral);
  background: rgba(232, 93, 74, 0.06);
  color: var(--coral);
}

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  z-index: 300;
  max-width: calc(100vw - 40px);
  border-radius: 20px;
  padding: 10px 20px;
  background: rgba(26, 23, 20, 0.88);
  color: var(--white);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 0.3s;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
}

@media (min-width: 768px) {
  :root {
    --app-max-width: min(100vw, 760px);
    --bottom-nav: 72px;
  }

  .topbar,
  .reader-topbar,
  .web-header,
  .vocab-header,
  .settings-header,
  .notes-header,
  .qa-header {
    padding-left: 32px;
    padding-right: 32px;
  }

  .shelf-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
    padding: 22px 32px 120px;
  }

  .reader-body {
    padding-left: 46px;
    padding-right: 46px;
  }

  .reader-text {
    font-size: 20px;
    line-height: 2.05;
  }

  .vocab-list,
  .settings-body,
  .notes-body,
  .qa-body {
    padding-left: 32px;
    padding-right: 32px;
    padding-bottom: 124px;
  }

  .settings-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
  }

  .settings-section {
    margin-bottom: 0;
  }

  .web-current,
  .web-site-section h2,
  .web-action-row,
  .web-reader-text,
  .web-injected-layer {
    padding-left: 32px;
    padding-right: 32px;
  }

  .web-site-item {
    width: calc(100% - 64px);
    margin-left: 32px;
    margin-right: 32px;
    padding: 16px 18px;
  }

  .web-frame-wrap,
  .web-injected-layer {
    height: calc(100vh - 210px);
    min-height: calc(100vh - 210px);
    max-height: calc(100vh - 210px);
  }

  .dict-sheet {
    border-radius: 28px 28px 0 0;
  }

  .dict-senses-scroll {
    height: 320px;
  }

  .qa-input-bar {
    grid-template-columns: 46px minmax(0, 1fr) 46px;
    padding: 12px 24px;
  }
}

@media (min-width: 1024px) {
  :root {
    --app-max-width: min(100vw, 980px);
  }

  .shelf-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .reader-body {
    padding-left: 90px;
    padding-right: 90px;
  }

  .reader-text {
    font-size: 21px;
  }

  .web-nav-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 10px;
    align-items: start;
  }

  .web-current,
  .web-favorites,
  .web-add-button {
    grid-column: 1 / -1;
  }
}

::-webkit-scrollbar {
  width: 0;
}
