header { gap: 20px; }
header nav { gap: 4px; }
.header-tools { position: relative; display: flex; align-items: center; gap: 6px; }
header .tool-button, header #account-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 8px 12px; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 10px; background: #172136;
  color: var(--text); font: inherit; font-size: 12px; white-space: nowrap; cursor: pointer;
}
header .tool-button:hover { background: #21314b; border-color: var(--cyan); transform: none; }
.keyboard-help { position: static; margin: 0; }
.keyboard-help summary { list-style: none; }
.keyboard-help summary::-webkit-details-marker { display: none; }
.keyboard-help[open] summary { border-color: var(--lime); color: var(--lime); background: #c8f76b12; }
.keyboard-help > .shortcut-panel {
  position: absolute; right: 0; top: calc(100% + 12px); z-index: 30;
  width: min(410px, calc(100vw - 32px)); box-sizing: border-box;
  max-height: calc(100dvh - 100px); overflow: auto;
  padding: 20px; border: 1px solid #50627f; border-radius: 18px;
  background: #121d30; box-shadow: 0 18px 60px #0009; color: var(--text);
}
.shortcut-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.shortcut-heading strong { font-size: 16px; }
.shortcut-heading > span { font-size: 11px; color: var(--muted); }
.shortcut-switch { display: flex; align-items: center; gap: 8px; margin: 16px 0; color: var(--lime); }
.shortcut-switch input { width: 16px; height: 16px; accent-color: var(--lime); }
.shortcut-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.shortcut-groups h3 { color: var(--cyan); font-size: 12px; margin: 0 0 10px; }
.shortcut-groups h3:not(:first-child) { margin-top: 18px; }
.keyboard-help .shortcut-panel p { font-size: 12px !important; line-height: 1.6; margin: 8px 0; }
.shortcut-groups p { display: flex; align-items: center; gap: 8px; }
kbd { display: inline-block; min-width: 20px; padding: 1px 4px; border: 1px solid #52617b; border-bottom-width: 3px; border-radius: 5px; background: #21304a; color: #edf4ff; font: 11px/1.6 ui-monospace, monospace; text-align: center; }
.shortcut-basics { margin-top: 16px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); }
.shortcut-basics p:last-child { font-size: 11px !important; }
.plan-strip { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0; }
.plan-strip button { display: flex; gap: 10px; padding: 7px 10px; font-size: 12px; color: var(--lime); background: #c8f76b0d; border-color: #c8f76b40; }
#plan-today { color: var(--muted); font-size: 11px; }
#plan-status { color: var(--lime); }
.session { flex-wrap: wrap; gap: 10px; }
.session #position, .session #remaining { white-space: nowrap; font-size: 11px; }
@media (min-width: 1101px) and (max-height: 900px) {
  .flashcard { padding-top: 16px; padding-bottom: 16px; }
  .flashcard .word { font-size: 42px; margin: 4px 0; }
  .flashcard .example-card { margin: 10px 0; }
  .flashcard .hint { margin-top: 10px; }
  .session { padding: 10px 3px; }
}
@media (max-width: 1100px) {
  header { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 24px; }
  .header-tools { margin-left: auto; }
  header nav { order: 3; width: 100%; margin: 0; }
  header nav .nav { flex: 1; padding: 9px 8px; }
}
@media (max-width: 600px) {
  header { padding: 10px 16px; gap: 8px; }
  header .tool-button, header #account-button { padding: 7px 9px; min-height: 36px; font-size: 11px; }
  .header-tools { gap: 4px; }
  .keyboard-help > .shortcut-panel { padding: 16px; max-height: calc(100dvh - 80px); }
  .shortcut-groups { gap: 12px; }
  .plan-strip { flex-wrap: wrap; }
  .session .mini-track { min-width: 24px; }
  /* Five tabs share the phone width: break only between words, never inside one. */
  header nav .nav { padding: 9px 2px; word-break: keep-all; }
}
