@import url('./fonts/font-face.css');

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--color-page);
  color: var(--color-text);
  font: var(--font-size-body)/var(--line-height-ui) var(--font-ui);
}
[hidden] { display: none !important; }
a { color: var(--color-accent); text-underline-offset: .2em; }
a:hover { color: var(--color-accent-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, summary { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, .button { -webkit-tap-highlight-color: transparent; }
:focus-visible {
  outline: var(--size-focus-width) solid var(--color-focus);
  outline-offset: var(--size-focus-offset);
}
::selection { background: var(--color-highlight); color: var(--color-on-highlight); }
.muted { color: var(--color-muted); }
.skip-link {
  position: fixed;
  inset: var(--space-2) auto auto var(--space-4);
  z-index: 200;
  transform: translateY(-150%);
}
.skip-link:focus { transform: none; }

.site-brand {
  display: inline-flex;
  align-items: center;
  min-height: var(--size-touch);
  border-radius: var(--radius-control);
}
.site-brand img { display: block; width: 100%; height: auto; }
body[data-theme="night"] .site-brand img { filter: brightness(0) invert(1); }

.button, .tool-button, .close-button, .theme-choices button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-inline-size: var(--component-control-min-size);
  min-block-size: var(--component-control-min-size);
  border: 1px solid var(--component-control-border);
  border-radius: var(--component-control-radius);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-size-ui);
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
}
.button-quiet, .tool-button, .close-button { border-color: transparent; background: transparent; }
.button-quiet { color: var(--color-accent); }
.tool-button, .close-button { padding: 0; }
.tool-button svg {
  width: var(--size-icon);
  height: var(--size-icon);
  fill: none;
  stroke: currentColor;
  stroke-width: var(--stroke-icon);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.close-button { font-size: 24px; }
.button:hover:not(:disabled), .tool-button:hover:not(:disabled),
.close-button:hover:not(:disabled), .theme-choices button:hover:not(:disabled) {
  background: var(--component-control-hover-surface);
  color: var(--color-accent-hover);
}
.button-primary {
  border-color: transparent;
  background: var(--component-primary-surface);
  color: var(--component-primary-text);
  font-weight: 600;
}
.button-primary:hover:not(:disabled) {
  background: var(--component-primary-hover-surface);
  color: var(--component-primary-text);
}
.button[aria-pressed="true"], .tool-button[aria-pressed="true"],
.tool-button[aria-expanded="true"], .theme-choices button[aria-pressed="true"] {
  border-color: var(--component-control-selected-text);
  background: var(--component-control-selected-surface);
  color: var(--component-control-selected-text);
}
.button:disabled, .tool-button:disabled, .close-button:disabled {
  border-color: var(--color-divider);
  background: var(--component-control-disabled-surface);
  color: var(--component-control-disabled-text);
}
.button[aria-busy="true"] { cursor: progress; }

.field {
  min-width: 0;
  min-height: var(--component-control-min-size);
  border: 1px solid var(--component-control-border);
  border-radius: var(--component-control-radius);
  background: var(--component-input-surface);
  color: var(--component-input-text);
  padding: var(--space-2) var(--space-3);
}
.field::placeholder { color: var(--color-muted); opacity: 1; }
.field[aria-invalid="true"] { border-color: var(--color-error); }
.field:disabled { background: var(--component-control-disabled-surface); color: var(--component-control-disabled-text); }
input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: var(--color-accent); }
.theme-choices { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.theme-choices button { gap: var(--space-1); }
.theme-choices button::before {
  content: '';
  inline-size: .8em;
  block-size: .8em;
  background: var(--swatch);
  border: 1px solid var(--color-border);
  border-radius: 50%;
}
.theme-choices [data-theme="paper"] { --swatch: var(--color-swatch-paper); }
.theme-choices [data-theme="white"] { --swatch: var(--color-swatch-white); }
.theme-choices [data-theme="night"] { --swatch: var(--color-swatch-night); }
.theme-choices button[aria-pressed="true"] { font-weight: 650; }
.theme-choices button[aria-pressed="true"]::before { outline: 1px solid currentColor; outline-offset: 2px; }

.panel, .word-card, .player {
  min-width: 0;
  background: var(--component-panel-surface);
  border: 1px solid var(--component-panel-border);
  border-radius: var(--component-panel-radius);
}
.panel { display: flex; flex-direction: column; }
.panel-header {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}
.panel-header h2, .panel-header h3 { margin: 0; font-size: 1.125rem; font-weight: 600; }
.panel-body { min-height: 0; padding: var(--space-4); overflow-wrap: anywhere; }
.word-card { padding: var(--space-4); overflow-wrap: anywhere; }
.word-card > .close-button { float: inline-end; margin: calc(-1 * var(--space-2)); }
.word-card-term { font: 400 1.75rem/1.2 var(--font-reading); margin: var(--space-2) 0; }
.word-card-meaning, .word-card-note { font-size: var(--font-size-ui); margin: var(--space-2) 0; }
.word-card-note { color: var(--color-muted); }
.word-card-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }

.player {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-1) var(--space-6);
  padding: var(--space-3) var(--space-6);
  font-size: var(--font-size-ui);
}
.player-heading, .player-controls, .player-preferences {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-width: 0;
}
.player-heading { grid-area: 1 / 1; }
.player-heading strong { font-weight: 600; }
.player-time { margin-inline-start: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.player-time, .player-status { color: var(--color-muted); font-size: var(--font-size-small); }
.player-progress { grid-area: 2 / 1; width: 100%; min-width: 0; min-height: 24px; margin: 0; }
.player-status { grid-area: 3 / 1; margin: 0; }
.player-controls { grid-area: 1 / 2 / 3; justify-content: center; }
.player-preferences { grid-area: 3 / 2; justify-content: space-between; }
.player-preferences label { display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--size-touch); cursor: pointer; }
.player-preferences input { width: 16px; height: 16px; margin: 0; }
.player-preferences .field { padding-inline: var(--space-2); }
.player-extra { grid-column: 1 / -1; justify-self: center; }
@media (max-width: 680px) {
  .player { grid-template-columns: minmax(0, 1fr); padding-inline: var(--space-4); }
  .player > * { grid-area: auto; }
  .player-controls > .button { flex: 1 1 auto; }
}

.notice {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-panel);
  background: var(--component-feedback-notice-surface);
  color: var(--component-feedback-notice-text);
}
.notice-error { background: var(--component-feedback-error-surface); color: var(--component-feedback-error-text); }
.notice-success { background: var(--component-feedback-success-surface); color: var(--component-feedback-success-text); }
.notice-empty { background: var(--color-surface); color: var(--color-muted); border: 1px dashed var(--color-border); }
.vocabulary-entry { border-top: 1px solid var(--color-divider); padding-block: var(--space-4); overflow-wrap: anywhere; }
.vocabulary-entry h3 { font: 400 1.75rem/1.2 var(--font-reading); margin: 0 0 var(--space-2); }
.vocabulary-entry blockquote { font: 1.25rem/1.6 var(--font-reading); margin: var(--space-3) 0; }
.vocabulary-note, .vocabulary-source { color: var(--color-muted); font-size: var(--font-size-ui); }
.vocabulary-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2); }
.directory-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  min-height: var(--size-touch);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-divider);
}
.directory-row[aria-current] { font-weight: 600; }
