/* 我爱记单词 - 静态站样式（对齐 OJ 页面风格） */
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

.macos-desk {
  --ink: #1c2430;
  --muted: #6b7280;
  --line: rgba(28, 36, 48, 0.08);
  --blue: #2563eb;
  --blue-press: #1d4ed8;
  --green: #28c840;
  --yellow: #febc2e;
  --red: #ff5f57;
  --glass: rgba(255, 255, 255, 0.82);
  --panel: rgba(255, 255, 255, 0.88);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 14px 28px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  box-sizing: border-box;
}

.desk-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 55% at 12% 8%, rgba(147, 197, 253, 0.35), transparent 58%),
    radial-gradient(ellipse 55% 45% at 88% 18%, rgba(165, 243, 252, 0.28), transparent 52%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(226, 232, 240, 0.9), transparent 60%),
    linear-gradient(165deg, #dbeafe 0%, #e2e8f0 42%, #f1f5f9 100%);
}

.mac-window {
  position: relative;
  z-index: 1;
  width: 880px;
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: var(--glass);
  backdrop-filter: saturate(160%) blur(24px);
  -webkit-backdrop-filter: saturate(160%) blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow:
    0 24px 64px rgba(30, 58, 95, 0.16),
    0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.titlebar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.78));
  border-bottom: 1px solid var(--line);
}

.traffic {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.12) inset;
}
.dot.close { background: var(--red); }
.dot.minimize { background: var(--yellow); }
.dot.zoom { background: var(--green); }

.titlebar-center {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #1c2430;
  text-align: center;
  user-select: none;
}

.titlebar-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.subject-seg {
  display: inline-flex;
  padding: 2px;
  border-radius: 980px;
  background: rgba(118, 118, 128, 0.14);
}

.seg-btn {
  height: 28px;
  padding: 0 12px;
  border: none;
  border-radius: 980px;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.seg-btn.on {
  color: #1e3a8a;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.seg-btn:hover:not(.on) { color: #334155; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.65);
}

.seg {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  background: rgba(118, 118, 128, 0.12);
}

.seg-item {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.seg-item.on {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 650;
  color: #1e40af;
  background: rgba(37, 99, 235, 0.1);
}

.chip.soft {
  color: #475569;
  background: rgba(148, 163, 184, 0.16);
}

.content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px 16px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 14px;
  align-items: start;
}

.content-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.practice-pane,
.practiced-pane,
.selected-pane {
  background: var(--panel);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(30, 58, 95, 0.05);
  min-width: 0;
}

.practice-pane {
  padding: 22px 18px 16px;
  text-align: center;
}

.practiced-pane,
.selected-pane { padding: 14px 16px 10px; }

.practiced-pane { text-align: left; }

.hint-label {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.word-display {
  min-height: 128px;
  max-height: 128px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.word-line {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  max-height: 44px;
  overflow: hidden;
  padding: 0 4px;
}

.word {
  font-size: clamp(24px, 5vw, 38px);
  font-weight: 700;
  font-family: "SF Mono", ui-monospace, Consolas, monospace;
  letter-spacing: 0.03em;
  color: var(--ink);
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phonetic-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 30px;
  max-height: 30px;
  overflow: hidden;
  padding: 0 4px;
}

.phonetic-row .phonetic {
  margin: 0;
  font-size: clamp(13px, 2.8vw, 16px);
  color: var(--muted);
  font-weight: 500;
  line-height: 1.2;
  max-width: calc(100% - 40px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-meaning {
  margin: 2px 0 0;
  min-height: 40px;
  max-height: 40px;
  overflow: auto;
  padding: 0 6px;
  font-size: 15px;
  line-height: 1.45;
  color: #48484a;
  text-align: center;
}

.icon-btn {
  border: none;
  background: rgba(118, 118, 128, 0.12);
  border-radius: 10px;
  padding: 6px 9px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background 0.15s, transform 0.15s;
}

.icon-btn:hover {
  background: rgba(118, 118, 128, 0.2);
  transform: scale(1.05);
}

.icon-btn.tiny {
  font-size: 13px;
  padding: 2px 6px;
}

.type-field {
  width: 100%;
  box-sizing: border-box;
  margin-top: 16px;
  height: 52px;
  min-height: 52px;
  max-height: 52px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.92);
  text-align: center;
  font-size: clamp(18px, 4.2vw, 24px);
  font-family: "SF Mono", ui-monospace, Consolas, monospace;
  letter-spacing: 0.05em;
  color: var(--ink);
  outline: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
  transition: border-color 0.15s, box-shadow 0.15s;
  overflow: hidden;
  text-overflow: ellipsis;
}

.type-field:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.type-field.ok {
  border-color: #34c759;
  background: #f0fff4;
}

.type-field.bad {
  border-color: #ff3b30;
  background: #fff5f5;
}

.controls {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mac-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 16px;
  border-radius: 980px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.12s, opacity 0.15s;
}

.mac-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none !important;
  transform: none !important;
}

.mac-btn.primary {
  color: #fff;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}

.mac-btn.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #60a5fa 0%, #1d4ed8 100%);
  transform: translateY(-1px);
}

.mac-btn.secondary {
  color: #1e40af;
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.18);
}

.mac-btn.secondary:hover:not(:disabled) {
  background: rgba(37, 99, 235, 0.16);
}

.mac-btn.soft {
  color: #475569;
  background: #fff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.mac-btn.soft:hover:not(:disabled) {
  color: #0f172a;
  border-color: #cbd5e1;
  background: #f8fafc;
}

.mac-btn.sm {
  height: 30px;
  font-size: 12px;
  padding: 0 14px;
}

.toggles {
  display: flex;
  gap: 14px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #3a3a3c;
  cursor: pointer;
  user-select: none;
}

.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch {
  width: 36px;
  height: 22px;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.32);
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s;
}

.toggle input:checked + .switch { background: #34c759; }
.toggle input:checked + .switch::after { transform: translateX(14px); }

.pane-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.pane-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.practiced-pane .pane-head h2,
.selected-pane .pane-head h2 {
  font-size: 16px;
}

.practiced-pane .empty,
.selected-pane .empty {
  font-size: 14px;
}

.badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 10px 0;
}

.history-list,
.selected-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(24vh, 200px);
  overflow-x: hidden;
  overflow-y: auto;
}

.selected-list {
  max-height: min(58vh, 520px);
}

.selected-pane {
  overflow-x: hidden;
  min-width: 0;
}

.history-item,
.selected-item {
  padding: 13px 0;
  border-top: 1px solid var(--line);
  min-width: 0;
}

.selected-item {
  overflow-wrap: break-word;
  word-break: break-word;
}

.history-item:first-child,
.selected-item:first-child { border-top: none; }

.selected-item.is-current {
  background: rgba(37, 99, 235, 0.06);
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 8px;
}

.s-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
  min-width: 0;
}

.s-word {
  font-family: "SF Mono", ui-monospace, Consolas, monospace;
  font-weight: 700;
  font-size: 17px;
  word-break: break-word;
}

.s-full {
  font-size: 13px;
  color: #ff9500;
  font-weight: 600;
  word-break: break-word;
}

.s-sub {
  font-size: 12px;
  font-weight: 650;
  color: var(--blue);
  background: rgba(37, 99, 235, 0.1);
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.s-meaning {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: #48484a;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
}

.s-index {
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  min-width: 1.4em;
}

.h-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.h-word {
  font-family: "SF Mono", ui-monospace, Consolas, monospace;
  font-weight: 700;
  font-size: 17px;
}

.h-full {
  font-size: 13px;
  color: #ff9500;
  font-weight: 600;
}

.h-sub {
  margin-left: auto;
  font-size: 12px;
  font-weight: 650;
  color: var(--blue);
  background: rgba(37, 99, 235, 0.1);
  padding: 2px 8px;
  border-radius: 999px;
}

.h-meaning {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: #48484a;
}

.site-footer {
  flex-shrink: 0;
  padding: 14px 16px 18px;
  text-align: center;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.75);
}

.site-footer p { margin: 0; }
.site-footer a {
  color: var(--muted);
  text-decoration: none;
}
.site-footer a:hover { color: var(--blue); }

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.modal-box {
  width: min(560px, 100%);
  max-height: min(86vh, 720px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
}

.dialog-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 16px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(118, 118, 128, 0.08);
}

.toolbar-btns {
  display: inline-flex;
  gap: 8px;
}

.draft-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.draft-count em {
  font-style: normal;
  font-weight: 700;
  color: var(--blue);
}

.tree-wrap {
  margin: 12px 16px;
  max-height: min(50vh, 420px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
}

.tree-subject,
.tree-lesson {
  margin: 4px 0;
}

.tree-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
}

.tree-label input { accent-color: var(--blue); }

.tree-children {
  margin-left: 18px;
  border-left: 1px solid #eef2f7;
  padding-left: 8px;
}

.tn-group { font-weight: 700; }
.tn-count { font-size: 12px; color: var(--muted); }
.tn-word {
  font-family: "SF Mono", ui-monospace, Consolas, monospace;
  font-weight: 700;
  flex-shrink: 0;
}
.tn-full { font-size: 12px; color: #ff9500; font-weight: 600; }
.tn-meaning {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.tree-word .tree-label {
  display: grid;
  grid-template-columns: 18px 90px 90px 1fr;
  align-items: center;
  gap: 6px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  z-index: 200;
  padding: 10px 18px;
  border-radius: 10px;
  background: rgba(28, 36, 48, 0.9);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* 横竖屏 / 移动端 */
.macos-desk.is-mobile .content {
  grid-template-columns: 1fr;
}

.macos-desk.is-mobile.is-landscape .content {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.macos-desk.is-mobile.is-portrait {
  padding: 0;
  align-items: stretch;
}

.macos-desk.is-mobile.is-portrait .mac-window {
  width: 100%;
  max-height: none;
  min-height: 100vh;
  min-height: 100dvh;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.macos-desk.is-mobile .titlebar {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px;
}

.macos-desk.is-mobile .traffic { display: none; }

.macos-desk.is-mobile .titlebar-center {
  text-align: left;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  white-space: normal;
  grid-column: 1 / -1;
  order: -1;
}

.macos-desk.is-mobile.is-portrait .word {
  font-size: clamp(34px, 10vw, 48px);
}

.macos-desk.is-mobile.is-portrait .type-field {
  height: 56px;
  font-size: 22px;
}

.macos-desk.is-mobile.is-portrait .controls {
  flex-direction: column;
  align-items: stretch;
}

.macos-desk.is-mobile.is-portrait .btns .mac-btn { flex: 1; }

.macos-desk.is-mobile.is-portrait .history-list {
  max-height: min(20vh, 160px);
}

.macos-desk.is-mobile.is-portrait .selected-list { max-height: min(28vh, 220px); }

.macos-desk.is-mobile.is-landscape {
  padding: 0;
  align-items: stretch;
}

.macos-desk.is-mobile.is-landscape .mac-window {
  width: 100%;
  max-height: none;
  min-height: 100vh;
  min-height: 100dvh;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.macos-desk.is-mobile.is-landscape .content {
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px 12px;
}

.macos-desk.is-mobile.is-landscape .site-footer { display: none; }

.macos-desk:not(.is-mobile).is-portrait .mac-window {
  width: min(880px, calc(100vw - 28px));
  max-height: min(920px, calc(100vh - 48px));
  border-radius: 28px;
}

@media (max-width: 480px) {
  .tree-word .tree-label {
    grid-template-columns: 18px 1fr;
  }
  .tree-word .tn-full,
  .tree-word .tn-meaning { display: none; }
}
