:root {
  color-scheme: dark;
  --bg: #050607;
  --card: #111419;
  --card-2: #171b22;
  --text: #f6f7f8;
  --muted: #9aa4b2;
  --line: rgba(255, 255, 255, 0.09);
  --accent: #37d67a;
  --accent-2: #13b8ff;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: radial-gradient(circle at 50% 0%, #18212b 0, var(--bg) 54%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

.watch-shell {
  width: min(100vw, 420px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) 9px max(12px, env(safe-area-inset-bottom));
}

.top-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)), var(--card);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

.top-card {
  padding: 10px;
}

.title-row,
.panel-head,
.input-row,
.type-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.title-row,
.panel-head {
  justify-content: space-between;
}

h1 {
  margin: 0;
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.status {
  max-width: 90px;
  overflow: hidden;
  color: var(--accent);
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.subject-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 8px 0 2px;
}

.subject-link {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b0f15;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.subject-link.active {
  border-color: rgba(55, 214, 122, 0.65);
  background: linear-gradient(135deg, var(--accent), #0dbb65);
  color: #041008;
}

.input-label {
  display: block;
  margin: 8px 0 6px;
  color: var(--muted);
  font-size: 12px;
}

.input-row input {
  min-width: 0;
  flex: 1;
  height: 39px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: #07090d;
  color: var(--text);
  padding: 0 12px;
  font-size: 18px;
  letter-spacing: 0.08em;
}

.input-row input:focus {
  border-color: rgba(55, 214, 122, 0.65);
  box-shadow: 0 0 0 3px rgba(55, 214, 122, 0.12);
}

button {
  min-height: 38px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #0dbb65);
  color: #041008;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.8);
  opacity: 0.45;
}

#guessBtn,
#fallbackBtn {
  width: 44px;
}

.guess-row {
  gap: 5px;
}

.token-box {
  margin: 6px 0 8px;
  padding: 7px;
  border: 1px solid rgba(255, 107, 107, 0.35);
  border-radius: 14px;
  background: rgba(255, 107, 107, 0.08);
}

.token-row input {
  height: 34px;
  font-size: 13px;
  letter-spacing: 0;
}

#saveTokenBtn {
  width: 54px;
  min-height: 34px;
  font-size: 12px;
}

.type-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 7px;
}

.type-chip {
  min-height: 30px;
  padding: 0 2px;
  border: 1px solid var(--line);
  background: #0b0f15;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.type-chip.active {
  border-color: rgba(55, 214, 122, 0.65);
  background: linear-gradient(135deg, var(--accent), #0dbb65);
  color: #041008;
}

.panel {
  margin-top: 8px;
  padding: 9px;
}

.panel-head {
  min-height: 30px;
  color: var(--muted);
  font-size: 12px;
}

.ghost {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.choices {
  display: grid;
  gap: 7px;
  margin-top: 6px;
}

.choice {
  width: 100%;
  min-height: 45px;
  padding: 8px 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 15px;
  background: #0b0f15;
  color: var(--text);
  text-align: left;
}

.choice strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.25;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.choice span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.1;
}

.choice:active {
  transform: scale(0.985);
  border-color: var(--accent-2);
}

.answer-panel {
  max-height: 196px;
  overflow: hidden;
}

.answer {
  max-height: 146px;
  margin-top: 4px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 3px;
  font-size: 13px;
  line-height: 1.45;
}

.answer h2 {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 15px;
  line-height: 1.25;
}

.answer p {
  margin: 0 0 7px;
}

.answer pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
}

.empty {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.error {
  color: var(--danger);
}

.loading {
  color: var(--accent-2);
}

@media (max-width: 360px) and (max-height: 430px) {
  .watch-shell {
    width: 352px;
    min-height: 410px;
    padding: 7px 8px;
  }

  .top-card,
  .panel {
    border-radius: 16px;
  }

  .top-card {
    padding: 8px;
  }

  h1 {
    font-size: 17px;
  }

  .subject-switch {
    margin: 6px 0 1px;
    gap: 4px;
  }

  .subject-link {
    min-height: 25px;
    border-radius: 11px;
    font-size: 11px;
  }

  .input-label {
    margin: 5px 0 4px;
    font-size: 11px;
  }

  .input-row input {
    height: 36px;
    font-size: 16px;
  }

  button {
    min-height: 35px;
  }

  #guessBtn {
    width: 52px;
  }

  .panel {
    margin-top: 7px;
    padding: 8px;
  }

  .choice {
    min-height: 40px;
    padding: 6px 8px;
  }

  .choice strong {
    font-size: 13px;
  }

  .answer-panel {
    max-height: 169px;
  }

  .answer {
    max-height: 121px;
    font-size: 12px;
    line-height: 1.38;
  }
}
