:root {
  /* Colour palette */
  --colour-bg: #1a1a1a;
  --colour-surface: rgba(33, 33, 33, 0.75);
  --colour-surface-elevated: rgba(42, 42, 42, 0.95);
  --colour-border: rgba(255, 255, 255, 0.08);
  --colour-border-strong: rgba(255, 255, 255, 0.15);
  --colour-text: #ffffff;
  --colour-text-muted: rgba(255, 255, 255, 0.7);
  --colour-text-subtle: rgba(255, 255, 255, 0.6);
  --colour-accent: #45a049;
  --colour-accent-hover: #3d8b40;
  --colour-accent-muted: rgba(76, 175, 80, 0.25);
  /* Green text on dark surfaces. The button green is too dark for small text. */
  --colour-accent-text: #5cbf61;
  /* White lettering on a filled control needs a deeper green than Wake Up. */
  --colour-accent-button: #3c7f40;
  --colour-accent-button-hover: #38773c;
  --colour-gold: #d4af37;
  --colour-gold-bright: #e6c547;
  --colour-good: rgba(25, 118, 210, 0.7);
  --colour-evil: rgba(211, 47, 47, 0.7);
  --colour-button-secondary: #2c3e2c;
  --colour-button-secondary-hover: #3c513c;
  --colour-blitz: #f44336;
  --colour-blitz-hover: #e53935;
  /* Red text on dark surfaces. The button red is too dark for small text. */
  --colour-blitz-text: #ff7d76;
  /* White lettering on a filled control needs a deeper red than Wake Up. */
  --colour-blitz-button: #d32f2f;
  --colour-blitz-button-hover: #c62828;
  /* Spacing and radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  /* Focus ring for accessibility / TV remote */
  --focus-ring: 3px solid var(--colour-accent);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  font-family:
    'DM Sans',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    Oxygen,
    Ubuntu,
    Cantarell,
    'Open Sans',
    sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 0.25rem;
  padding-top: 0.25rem;
  background-color: var(--colour-bg);
  color: var(--colour-text);
  position: relative;
}

body.stale-tab-banner-visible {
  padding-top: calc(0.25rem + var(--stale-tab-banner-height, 0px));
}

.stale-tab-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1rem;
  padding: 0.75rem 1rem 0.95rem;
  background: var(--colour-surface-elevated);
  border-bottom: 1px solid var(--colour-gold);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.stale-tab-banner[hidden] {
  display: none;
}

.stale-tab-banner-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.stale-tab-banner-message {
  margin: 0;
  color: var(--colour-text);
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.4;
}

.stale-tab-banner-message strong {
  color: var(--colour-gold-bright);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.stale-tab-banner-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  width: 100%;
  background: var(--colour-gold);
  transform-origin: left center;
  pointer-events: none;
}

@keyframes stale-tab-refresh-countdown {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

.stale-tab-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.stale-tab-banner-actions button {
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--colour-border-strong);
  background: var(--colour-button-secondary);
  color: var(--colour-text);
  cursor: pointer;
  font: inherit;
  transition: background var(--transition-fast);
}

.stale-tab-banner-actions button:hover {
  background: var(--colour-button-secondary-hover);
}

.stale-tab-banner-actions button.primary-btn {
  background: var(--colour-accent-button);
  border-color: transparent;
}

.stale-tab-banner-actions button.primary-btn:hover {
  background: var(--colour-accent-button-hover);
}

/* Background theme styles */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.15;
  z-index: -1;
}

/* Background theme classes */
body[data-theme='gothic-city']::before {
  background-image: url('../images/backgrounds/gothic-city.png');
}
body[data-theme='medieval-cartoon']::before {
  background-image: url('../images/backgrounds/medieval-cartoon.png');
}
body[data-theme='tower-in-forest']::before {
  background-image: url('../images/backgrounds/tower-in-forest.png');
}
body[data-theme='infested-city']::before {
  background-image: url('../images/backgrounds/infested-city.png');
}
body[data-theme='circle-of-people']::before {
  background-image: url('../images/backgrounds/circle-of-people.png');
}
body[data-theme='large-clock-face']::before {
  background-image: url('../images/backgrounds/large-clock-face.png');
}

/* The day image stays on ::before. This plate covers it with the same
   15% night sky, and only its opacity crossfades. Settings drops the plate
   so the saved wallpaper shows. The game--night class is unchanged. */
.night-wallpaper {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: var(--colour-bg);
  background-image:
    linear-gradient(rgba(26, 26, 26, 0.85), rgba(26, 26, 26, 0.85)),
    url('../images/backgrounds/night-sky.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
}

body.wallpaper-ready .night-wallpaper {
  transition: opacity 600ms ease-in-out;
}

body.game--night:not(:has(#settingsDialog[open])) .night-wallpaper {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  body.wallpaper-ready .night-wallpaper {
    transition: none;
  }
}

/* Blitz mode red theme overrides.
   Grouped selectors share one declaration. Each selector keeps its own specificity. */
body[data-pace='blitz'] .preset-btn,
body[data-pace='blitz'] .minute-btn,
body[data-pace='blitz'] #accelerateBtn,
body[data-pace='blitz'] #fullscreenBtn,
body[data-pace='blitz'] #settingsBtn,
body[data-pace='blitz'] #infoBtn,
body[data-pace='blitz'] .clocktower-presets button,
body[data-pace='blitz'] .number-input-group button,
body[data-pace='blitz'] .preview-sound {
  background-color: #3e2c2c;
}

body[data-pace='blitz'] .preset-btn:hover,
body[data-pace='blitz'] .minute-btn:hover,
body[data-pace='blitz'] #accelerateBtn:hover,
body[data-pace='blitz'] #fullscreenBtn:hover,
body[data-pace='blitz'] #settingsBtn:hover,
body[data-pace='blitz'] #infoBtn:hover,
body[data-pace='blitz'] .clocktower-presets button:hover,
body[data-pace='blitz'] .number-input-group button:hover,
body[data-pace='blitz'] .preview-sound:hover {
  background-color: #513c3c;
}

body[data-pace='blitz'] .preset-btn.active,
body[data-pace='blitz'] .minute-btn.active,
body[data-pace='blitz'] .clocktower-presets button.active {
  background-color: var(--colour-blitz);
}

body[data-pace='blitz'] #startBtn {
  background-color: var(--colour-blitz);
  border: 1px solid rgba(244, 67, 54, 0.2);
}

body[data-pace='blitz'] #startBtn:hover {
  background-color: var(--colour-blitz-hover);
}

body[data-pace='blitz'] #startBtn:active {
  background-color: #d32f2f;
}

body[data-pace='blitz'] .pace-indicator {
  background: rgba(244, 67, 54, 0.3);
}

body[data-pace='blitz'] .day-display .pace-indicator {
  background: rgba(139, 44, 44, 0.15);
  color: #8b2c2c;
}

body[data-pace='blitz'] .day-display.dusk .pace-indicator {
  color: #e6e1d6;
}

body[data-pace='blitz'] .dialog-content h3,
body[data-pace='blitz'] .setting-group h3,
body[data-pace='blitz'] .changes-section h3,
body[data-pace='blitz'] .changes-section li::before,
body[data-pace='blitz'] .playlist-link,
body[data-pace='blitz'] .playlist-link::before,
body[data-pace='blitz'] .changelog-link,
body[data-pace='blitz'] .disclaimer a,
body[data-pace='blitz'] .main-site-link a {
  color: var(--colour-blitz-text);
}

body[data-pace='blitz'] .version-number,
body[data-pace='blitz'] .portrait-warning-dialog h2 {
  color: var(--colour-blitz);
}

body[data-pace='blitz'] .playlist-link:hover {
  color: #ffb0aa;
}

body[data-pace='blitz'] .dialog-buttons button.primary-btn,
body[data-pace='blitz'] .tab-button.active,
body[data-pace='blitz'] .portrait-warning-dialog button {
  background: var(--colour-blitz-button);
}

body[data-pace='blitz'] .dialog-buttons button.primary-btn:hover,
body[data-pace='blitz'] .portrait-warning-dialog button:hover {
  background: var(--colour-blitz-button-hover);
}

body[data-pace='blitz'] .setting-group input[type='checkbox'] {
  accent-color: var(--colour-blitz);
}

body[data-pace='blitz'] .volume-slider::-webkit-slider-thumb {
  background: var(--colour-blitz);
}

body[data-pace='blitz'] .preview-sound.playing {
  background: var(--colour-blitz);
  box-shadow: 0 0 12px rgba(244, 67, 54, 0.4);
}

body[data-pace='blitz']::after {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(244, 67, 54, 0.28);
  pointer-events: none;
  z-index: -1;
}

body[data-pace='blitz'] .bottom-container {
  background: rgba(183, 28, 28, 0.78);
  border-top-color: rgba(244, 67, 54, 0.55);
}

/* Background theme selector styles */
.background-theme-select {
  width: 100%;
  padding: 8px;
  border: 1px solid #444;
  border-radius: 4px;
  background: #2a2a2a;
  color: #fff;
  cursor: pointer;
}

.background-theme-select:hover {
  border-color: #666;
}

.background-theme-select:focus {
  outline: none;
  border-color: #72a4f2;
}

.container {
  background-color: var(--colour-surface);
  padding: 0.75rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--colour-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  text-align: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  width: 95%;
  max-width: 1000px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.timer-display {
  min-height: calc(min(15vw, 11rem) * 1.2);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0;
  position: relative;
}

.timer-display .time {
  font-size: min(15vw, 11rem);
  font-family: 'Azeret Mono', ui-monospace, 'Cascadia Mono', monospace;
  font-weight: 600;
  color: var(--colour-gold);
  font-variant-numeric: tabular-nums;
  text-shadow:
    0 4px 12px rgba(0, 0, 0, 0.4),
    0 0 24px rgba(212, 175, 55, 0.15);
  line-height: 0.9;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.1em;
  /* Hidden until Azeret Mono loads to avoid font flicker */
  opacity: 0;
  transition: opacity 0.15s ease;
}

html.fonts-ready .timer-display .time {
  opacity: 1;
}

.timer-display.wake-up-countdown .time {
  color: var(--colour-accent);
  animation: pulse-text 2s infinite;
}

.timer-display.wake-up-countdown::before {
  content: 'Day starts in:';
  display: block;
  font-size: min(4vw, 2rem);
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  animation: none;
  line-height: 1;
  margin-bottom: -0.5em;
}

.nominations-countdown {
  font-size: min(4vw, 1.5rem);
  color: var(--colour-text);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  margin-top: 0.5rem;
  padding: 0.25rem 0.75rem;
  background: var(--colour-accent-muted);
  border-radius: var(--radius-sm);
  line-height: 1.2;
}

.nominations-countdown[hidden] {
  display: none;
}

@keyframes pulse-text {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 1;
  }
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0;
  border: none;
  padding: 0;
  min-inline-size: 0;
}

.controls legend {
  padding: 0;
  float: inline-start;
  overflow: hidden;
  position: absolute;
  width: 1px;
  height: 1px;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
}

.time-inputs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.minutes-presets,
.seconds-presets {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.minutes-presets {
  margin-bottom: 0.5rem;
}

.preset-btn {
  background-color: var(--colour-button-secondary);
  color: white;
  padding: 0.5rem 1rem;
  font-size: 1.2rem;
  min-width: 3rem;
  transition:
    background-color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.preset-btn:hover {
  background-color: var(--colour-button-secondary-hover);
}

.preset-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.4);
}

.preset-btn.active {
  background-color: var(--colour-accent);
}

.minute-btn {
  background-color: var(--colour-button-secondary);
}

.minute-btn:hover {
  background-color: var(--colour-button-secondary-hover);
}

.minute-btn.active {
  background-color: var(--colour-accent);
}

.timer-actions {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.day-info {
  position: absolute;
  top: 50%;
  left: 0.5rem;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: 120px;
}

.current-time {
  font-family: 'Azeret Mono', ui-monospace, 'Cascadia Mono', monospace;
  font-size: 0.95rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  line-height: 1;
  width: 100%;
  text-align: center;
}

.session-countdown {
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  line-height: 1.2;
  min-width: 140px;
  text-align: center;
}

.session-countdown[hidden] {
  display: none;
}

.session-countdown.final-hour {
  color: var(--colour-gold);
}

.session-countdown.times-up {
  color: #ff6b6b;
  font-weight: 700;
  letter-spacing: 0.02em;
}

#startBtn {
  position: static;
  transform: none;
  background-color: var(--colour-accent);
  color: white;
  padding: 1.5rem 1rem;
  border: 1px solid rgba(76, 175, 80, 0.2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 700;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast);
  min-width: 140px;
  min-height: 80px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

#startBtn:focus-visible {
  outline: none;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.25),
    0 0 0 3px rgba(76, 175, 80, 0.5);
}

#startBtn .button-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

#startBtn .button-text {
  display: block;
}

.shortcut-hint {
  display: inline-block;
  background-color: #2a2a2a;
  color: #f0f0f0;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  font-family: monospace;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(0, 0, 0, 0.3);
  min-width: 24px;
  text-align: center;
}

.shortcut-hint:empty {
  display: none;
}

#startBtn:hover {
  background-color: var(--colour-accent-hover);
  transform: translateY(1px);
}

#startBtn:active {
  background-color: var(--colour-accent-hover);
  transform: translateY(2px) scale(0.98);
}

#resetBtn {
  background-color: #8b4513;
  color: white;
  min-width: 120px;
  position: static;
}

#resetBtn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.5);
}

#resetBtn:hover {
  background-color: #6b3410;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#accelerateBtn {
  background-color: var(--colour-button-secondary);
  color: white;
  min-width: 160px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: static;
  transition: all 0.2s;
}

#accelerateBtn .button-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

#accelerateBtn:focus-visible {
  outline: none;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 0 0 3px rgba(76, 175, 80, 0.4);
}

#accelerateBtn:hover {
  background-color: var(--colour-button-secondary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

#accelerateBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#accelerateBtn:active {
  transform: scale(0.98);
}

#fullscreenBtn {
  opacity: 0.7;
}

#fullscreenBtn:hover {
  opacity: 1;
}

/* Move fullscreen button to top right in fullscreen mode */
:fullscreen #fullscreenBtn {
  bottom: 1rem;
  right: 1rem;
}

.fullscreen-icon {
  display: block;
}

/* Fullscreen mode adjustments */
:fullscreen .container {
  width: 90vw;
  height: auto;
  min-height: auto;
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: none;
  margin: 2rem auto;
}

:fullscreen .timer-display {
  font-size: min(18vw, 16rem);
  margin: 0;
  line-height: 1;
}

:fullscreen .controls {
  margin-top: 0;
  gap: 1rem;
}

#settingsBtn,
#infoBtn,
#fullscreenBtn {
  background-color: var(--colour-button-secondary);
  border: none;
  padding: 0.75rem;
  cursor: pointer;
  color: #ffffff;
  border-radius: var(--radius-md);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 48px;
  height: 48px;
  width: 48px;
  position: static;
}

#settingsBtn:focus-visible,
#infoBtn:focus-visible,
#fullscreenBtn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.5);
}

#settingsBtn:hover,
#infoBtn:hover,
#fullscreenBtn:hover {
  background-color: var(--colour-button-secondary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

#settingsBtn:active,
#infoBtn:active,
#fullscreenBtn:active {
  background-color: var(--colour-button-secondary);
  transform: translateY(0) scale(0.98);
}

.settings-icon,
.info-icon,
.fullscreen-icon {
  width: 24px;
  height: 24px;
}

.youtube-player-container {
  position: static;
  height: 36px;
  min-width: 120px;
  opacity: 0.85;
  transition: all 0.3s;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(33, 33, 33, 0.95);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  margin-left: auto;
  margin-right: 0.5rem;
}

/* Settings Dialog */
.settings-dialog {
  border: 1px solid var(--colour-border);
  border-radius: var(--radius-xl);
  padding: 0;
  background-color: var(--colour-surface-elevated);
  color: var(--colour-text);
  width: min(640px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: 90vh;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  opacity: 0;
  visibility: hidden;
  display: none;
  transition: opacity 0.3s ease-out;
}

.settings-dialog[open] {
  opacity: 1;
  visibility: visible;
  animation: none;
  display: block;
}

.dialog-content {
  padding: 0.75rem;
  overflow-y: auto;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dialog-content h2 {
  font-size: 1rem;
  margin: 0;
  margin-bottom: 0.25rem;
  color: var(--colour-text-muted);
  text-align: center;
  font-weight: normal;
}

.dialog-content h3 {
  font-size: 1rem;
  margin: 0 0 0.75rem 0;
  color: var(--colour-accent-text);
  font-weight: 500;
}

.setting-group {
  padding: 0.75rem;
  gap: 0.5rem;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  border: 1px solid var(--colour-border-strong);
  height: fit-content;
  position: relative;
}

.setting-group h3 {
  font-size: 0.95rem;
  margin: 0 0 0.35rem 0;
  color: var(--colour-accent-text);
  font-weight: 500;
}

.setting-group label,
.setting-group .setting-field,
.setting-group .auto-nominations-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem;
  border-radius: 8px;
  font-size: 0.95rem;
}

.setting-group .setting-field > label,
.setting-group .auto-nominations-row > label {
  padding: 0;
}

.setting-group label:hover,
.setting-group .setting-field:hover,
.setting-group .auto-nominations-row:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.setting-group label span {
  font-size: 1rem;
  color: #fff;
}

.setting-group > label > span {
  flex: none;
}

.info-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  border-radius: 8px;
  font-size: 0.95rem;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.info-display span:first-child {
  font-size: 1rem;
  color: #fff;
}

.info-value-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}

.info-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--colour-accent);
  font-variant-numeric: tabular-nums;
}

.info-value-note {
  font-size: 0.8rem;
  color: var(--colour-text-subtle);
  font-weight: normal;
}

.setting-group .auto-nominations-row .auto-nominations-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.setting-group select {
  background: #2a2a2a;
  border: 1px solid #444;
  color: white;
  padding: 8px;
  border-radius: 4px;
  font-size: 1rem;
  min-width: 120px;
}

.setting-group select:hover {
  border-color: #666;
}

.setting-group select:focus {
  outline: none;
  border-color: #72a4f2;
}

.setting-group input[type='text']:hover,
.setting-group input[type='number']:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.setting-group input[type='text']:focus,
.setting-group input[type='number']:focus {
  border-color: #4caf50;
  outline: none;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  max-width: 200px;
}

.volume-slider {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  -webkit-appearance: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--colour-accent);
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.volume-slider:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.5);
}

.volume-value {
  min-width: 48px;
  font-size: 0.9rem;
  color: var(--colour-text-muted);
}

#closeSettings {
  background-color: #444;
  color: white;
}

#closeSettings:hover {
  background-color: #555;
}

.character-counts-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0;
  padding: 0;
  width: 95%;
  max-width: 1000px;
  border-bottom: 1px solid var(--colour-border);
  padding-bottom: 0.5rem;
}

.character-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  align-items: stretch;
  padding: 0.5rem;
  width: 100%;
  /* Fixed height so row is content-sized; QR block can stretch to fill */
  height: 4.75rem;
  min-height: 4.75rem;
  box-sizing: border-box;
  margin-bottom: 0.5rem;
}

.pace-indicator {
  font-size: 0.8rem;
  padding: 0.15rem 0.5rem;
  margin-top: 0.25rem;
  background: var(--colour-accent-muted);
  border-radius: var(--radius-md);
  display: inline-block;
  line-height: 1;
}

.day-display {
  position: static;
  transform: none;
  z-index: 2;
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  background: #f5f1e6;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(139, 69, 19, 0.2);
  transition: background-color var(--transition-normal);
  width: 120px;
}

.day-display::before {
  content: 'DAY';
  display: block;
  background: #8b4513;
  color: #f5f1e6;
  width: 100%;
  padding: 0.2rem 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  font-weight: bold;
}

.day-display span {
  color: #2c3e2c;
  padding: 0.35rem 0;
  font-size: 2.5rem;
  line-height: 1;
  font-weight: 800;
}

.day-display .pace-indicator {
  font-size: 0.8rem;
  padding: 0.15rem 0.5rem;
  margin: 0 0 0.5rem 0;
  background: rgba(44, 62, 44, 0.15);
  border-radius: 4px;
  display: inline-block;
  line-height: 1;
  color: #2c3e2c;
}

.day-display.dawn {
  background: #fff8e6;
  box-shadow: 0 4px 12px rgba(255, 160, 0, 0.2);
}

.day-display.dawn span {
  color: #b87d3b;
}

.day-display.dawn .pace-indicator {
  background: rgba(184, 125, 59, 0.15);
  color: #885c2c;
}

.day-display.dusk {
  background: #4d3319;
  box-shadow: 0 4px 12px rgba(101, 67, 33, 0.4);
}

.day-display.dusk span {
  color: #e6e1d6;
}

.day-display.dusk .pace-indicator {
  background: rgba(230, 225, 214, 0.15);
  color: #e6e1d6;
}

.dialog-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
  gap: 1rem;
}

.dialog-buttons button {
  flex: 1;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  background-color: #4a4a4a;
  color: white;
}

.dialog-buttons button.primary-btn {
  background-color: var(--colour-accent-button);
  color: white;
}

.dialog-buttons button:not(.primary-btn) {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.dialog-buttons button:hover {
  background-color: #45a049;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.dialog-buttons button.primary-btn:hover {
  background: var(--colour-accent-button-hover);
}

.dialog-buttons button:not(.primary-btn):hover {
  background: rgba(255, 255, 255, 0.15);
}

.clocktower-presets button.skipped-day {
  padding-left: 0.4rem;
  padding-right: 0.4rem;
  background-color: rgba(26, 26, 26, 0.85);
  border: 1px solid var(--colour-border);
  opacity: 0.55;
  filter: saturate(0.5);
}

.clocktower-presets button.skipped-day:hover {
  opacity: 0.65;
  background-color: rgba(32, 32, 32, 0.9);
}

.clocktower-presets button.past-day {
  opacity: 0.55;
  filter: saturate(0.6);
}

.clocktower-presets button.past-day:hover {
  opacity: 0.7;
}

.clocktower-presets button.current-day {
  box-shadow: 0 0 0 2px var(--colour-gold);
  animation: pulse 2s infinite;
}

.character-type {
  flex: 1;
  min-width: 100px;
  background-color: var(--colour-surface-elevated);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  text-align: center;
  transition: background-color var(--transition-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid var(--colour-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.character-type .label {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.88);
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.character-type .amount {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--colour-text);
  line-height: 1;
}

/* Good team (blue background) */
.character-type:nth-child(1),
.character-type:nth-child(2) {
  background: var(--colour-good);
}

/* Evil team (red background) */
.character-type:nth-child(3),
.character-type:nth-child(4) {
  background: var(--colour-evil);
}

/* Off-screen colour filters for the player-count QR. Not displayed. */
.player-count-qr-filters {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Paper card beside the player counts. Padding is the quiet zone, in the
   same colour as the code background, so the rounded border does not cut
   the modules. Module colours come from the SVG filters in the page. */
.character-type.player-count-qr {
  --qr-paper: #f5f1e6;
  --qr-border: rgba(60, 42, 28, 0.4);
  display: none;
  flex: 0 0 auto;
  align-self: stretch;
  width: 4.75rem;
  min-width: 0;
  min-height: 0;
  padding: 0.25rem;
  box-sizing: border-box;
  justify-content: center;
  background: var(--qr-paper);
  border: 1px solid var(--qr-border);
  box-shadow: none;
  transition: none;
}

body.game--night .character-type.player-count-qr {
  --qr-paper: #e6eef5;
  --qr-border: rgba(18, 37, 54, 0.45);
}

.character-type.player-count-qr.visible {
  display: flex;
}

.character-type.player-count-qr a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  background: var(--qr-paper);
  overflow: visible;
}

.character-type.player-count-qr img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  max-height: 100%;
  object-fit: contain;
  border-radius: 0;
  filter: url(#player-count-qr-day);
}

body.game--night .character-type.player-count-qr img {
  filter: url(#player-count-qr-night);
}

.character-type.traveller {
  display: none;
  background: rgba(198, 93, 0, 0.9);
  border: 2px solid rgba(255, 215, 0, 0.7);
  box-shadow: 0 0 10px rgba(255, 140, 0, 0.3);
}

.character-type.traveller .label {
  color: #ffffff;
}

.character-type.traveller.visible {
  display: flex;
}

/* Regular presets */
#regularPresets,
#regularSecondsPresets {
  display: flex;
}

.clocktower-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.25rem;
  width: 100%;
  margin: 0.25rem 0;
}

.clocktower-presets button {
  padding: 0.35rem 0.75rem;
  font-size: 1.1rem;
  background-color: var(--colour-button-secondary);
  border: 1px solid var(--colour-border);
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
  width: 100%;
}

.clocktower-presets button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.4);
}

.clocktower-presets button:hover {
  background-color: var(--colour-button-secondary-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.clocktower-presets button.active {
  background-color: var(--colour-accent);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
  color: #101010;
}

.clocktower-presets button.active .day {
  opacity: 1;
}

.clocktower-presets button .time {
  font-size: 1.1rem;
  font-weight: bold;
  line-height: 1;
}

.clocktower-presets button .day {
  font-size: 0.75rem;
  opacity: 0.8;
  line-height: 1;
}

/* Night quiets the central panel only. Wake Up, player counts, focus rings,
   and the daytime rules above are unchanged. No added animation. */
body.game--night .container {
  background-color: rgba(16, 28, 44, 0.94);
  border-color: rgba(143, 170, 196, 0.28);
}

body.game--night .timer-display .time,
body.game--night .timer-display.wake-up-countdown .time {
  color: #7f96ae;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

body.game--night .timer-display.wake-up-countdown::before {
  color: #c5d4e4;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}

body.game--night .current-time,
body.game--night .session-countdown:not(.final-hour):not(.times-up) {
  color: #b7c6d6;
}

body.game--night .day-display,
body.game--night .day-display.dawn,
body.game--night .day-display.dusk {
  background: #1a2838;
  border-color: rgba(143, 170, 196, 0.22);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

body.game--night .day-display::before {
  background: #102033;
  color: #d5e2ef;
}

body.game--night .day-display span,
body.game--night .day-display.dawn span,
body.game--night .day-display.dusk span {
  color: #e4edf6;
}

body.game--night .day-display .pace-indicator,
body.game--night .day-display.dawn .pace-indicator,
body.game--night .day-display.dusk .pace-indicator,
body[data-pace='blitz'].game--night .day-display .pace-indicator,
body[data-pace='blitz'].game--night .day-display.dusk .pace-indicator {
  background: rgba(186, 206, 224, 0.16);
  color: #d5e2ef;
}

body.game--night .clocktower-presets button:not(.active):not(.skipped-day) {
  background-color: #162231;
  border-color: rgba(143, 170, 196, 0.16);
  color: #c5d3e2;
}

body.game--night .clocktower-presets button .time {
  color: #d5e1ee;
}

body.game--night .clocktower-presets button .day {
  opacity: 1;
  color: #b7c8da;
}

body.game--night
  .clocktower-presets
  button:hover:not(.skipped-day):not(.past-day):not(.active) {
  background-color: #223246;
}

body.game--night .clocktower-presets button.active {
  background-color: #2c4258;
  border-color: rgba(168, 196, 220, 0.5);
  box-shadow: none;
  color: #e8eef6;
}

body.game--night .clocktower-presets button.active .time,
body.game--night .clocktower-presets button.active .day {
  color: #e8eef6;
}

body.game--night .clocktower-presets button.active:hover {
  background-color: #34506a;
}

body.game--night .clocktower-presets button.current-day {
  box-shadow: 0 0 0 2px #7f96ae;
  animation: none;
}

body.game--night .clocktower-presets button.skipped-day,
body.game--night .clocktower-presets button.past-day,
body.game--night .clocktower-presets button.skipped-day .time,
body.game--night .clocktower-presets button.skipped-day .day,
body.game--night .clocktower-presets button.past-day .time,
body.game--night .clocktower-presets button.past-day .day {
  color: #f2f6fa;
}

body.game--night .clocktower-presets button:focus-visible {
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.4);
}

/* Minute and second presets stay in the page for timer setup, but are not shown. */
#regularTimerControls {
  display: none;
}

:fullscreen .clocktower-presets {
  margin-bottom: 0.5rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* Info Dialog */
.info-dialog {
  padding: 0;
  border: 1px solid var(--colour-border);
  border-radius: var(--radius-lg);
  background-color: #1a2b1a;
  color: white;
  max-width: 600px;
  width: 90%;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  opacity: 0;
  visibility: hidden;
  display: none;
  max-height: 90vh;
}

.info-dialog[open] {
  opacity: 1;
  visibility: visible;
  display: block;
}

.info-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
}

.info-dialog .dialog-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
  max-height: 90vh;
  overflow: hidden;
}

.info-dialog-main {
  display: flex;
  gap: 1.5rem;
  flex: 1;
  min-height: 0;
}

.qr-code-column {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.info-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.info-dialog .dialog-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1rem;
}

.version-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.version-display span:first-child {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}

.version-display span:nth-child(2) {
  color: var(--colour-accent);
  font-weight: bold;
  font-size: 1rem;
}

.changelog-link {
  color: var(--colour-accent);
  text-decoration: none;
  font-size: 0.9rem;
  margin-left: 0.5rem;
  padding-left: 0.5rem;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.changelog-link:hover {
  text-decoration: underline;
}

.qr-code-container {
  background: white;
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  max-width: 200px;
  width: 100%;
}

.qr-code-container img {
  max-width: 150px;
  height: auto;
  margin-bottom: 0.5rem;
}

.website-link {
  margin: 0;
  word-break: normal;
  white-space: nowrap;
}

.website-link a {
  color: #1a2b1a;
  text-decoration: none;
  font-family: monospace;
  font-size: 0.75rem;
  white-space: nowrap;
}

.website-link a:hover {
  text-decoration: underline;
}

.disclaimer {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
}

.disclaimer a {
  color: var(--colour-accent);
  text-decoration: none;
}

.disclaimer a:hover {
  text-decoration: underline;
}

.kofi-container {
  margin: 1rem 0;
  text-align: center;
}

.main-site-link {
  margin: 0;
  text-align: center;
}

.main-site-link a {
  color: var(--colour-accent);
  text-decoration: none;
}

.main-site-link a:hover {
  text-decoration: underline;
}

.kofi-container img {
  height: 36px;
  width: auto;
  transition: transform 0.2s ease;
}

.kofi-container a:hover img {
  transform: translateY(-2px);
}

.game-pace-select {
  width: 100%;
  padding: 0.5rem;
  font-size: 1rem;
  border: 1px solid #4a4a4a;
  border-radius: var(--radius-md);
  background-color: var(--colour-button-secondary);
  color: white;
  cursor: pointer;
}

.game-pace-select:hover {
  background-color: var(--colour-button-secondary-hover);
}

.game-pace-select:focus {
  outline: none;
  border-color: var(--colour-accent);
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.session-end-time-inputs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.session-end-select {
  min-width: 4.5rem;
  padding: 0.5rem;
  font-size: 1rem;
  font-family: 'Azeret Mono', ui-monospace, 'Cascadia Mono', monospace;
  border: 1px solid #4a4a4a;
  border-radius: var(--radius-md);
  background-color: var(--colour-button-secondary);
  color: white;
  cursor: pointer;
}

.session-end-select:hover {
  background-color: var(--colour-button-secondary-hover);
}

.session-end-select:focus {
  outline: none;
  border-color: var(--colour-accent);
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.session-end-separator {
  color: rgba(255, 255, 255, 0.8);
  font-family: 'Azeret Mono', ui-monospace, 'Cascadia Mono', monospace;
  font-weight: 600;
}

.youtube-player-container:hover {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.youtube-player-container iframe {
  position: absolute;
  top: -9999px;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.youtube-control {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: #fff;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  transition: all 0.2s;
  border-radius: 50%;
}

.youtube-control:hover {
  opacity: 1;
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.1);
}

.youtube-control svg {
  width: 20px;
  height: 20px;
}

.playlist-name {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  margin: 0;
  padding-right: 0.75rem;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  cursor: help;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  line-height: 1.1;
}

.volume-info {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  padding-right: 0.75rem;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  line-height: 1.2;
  text-align: right;
  min-width: 100px;
}

.playlist-name .playlist-label {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.75rem;
}

.playlist-name .track-title {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.85rem;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: #666;
  border-color: #444;
}

#startBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: #8b4513;
  border-color: #654321;
  color: rgba(255, 255, 255, 0.7);
  transform: none;
}

.restore-link {
  display: block;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  color: #4caf50;
  text-decoration: none;
  opacity: 0.8;
  transition:
    color 0.2s ease,
    opacity 0.2s ease;
  text-align: right;
  padding-right: 0.5rem;
}

.restore-link:hover {
  color: #81c784;
  text-decoration: underline;
  opacity: 1;
}

.restore-link.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  color: #666;
  pointer-events: none;
}

.playlist-link.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  color: #666;
  pointer-events: none;
}

.youtube-icon {
  width: 16px;
  height: 16px;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.youtube-link:hover .youtube-icon {
  opacity: 1;
}

.youtube-link.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  color: #666;
  pointer-events: none;
}

.number-input-group {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.number-input-group button {
  background-color: var(--colour-button-secondary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background-color var(--transition-fast),
    transform var(--transition-fast);
}

.number-input-group button:hover {
  background-color: var(--colour-button-secondary-hover);
}

.number-input-group button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.4);
}

.number-input-group input[type='number'] {
  width: 60px;
  text-align: center;
  padding: 0.5rem;
  border: 1px solid #444;
  border-radius: 6px;
  background: #2a2a2a;
  color: #fff;
  font-size: 1rem;
}

/* Restore checkbox styling */
.setting-group input[type='checkbox'],
.setting-group input[type='radio'] {
  width: 24px;
  height: 24px;
  accent-color: var(--colour-accent);
  cursor: pointer;
  position: relative;
}

.setting-group input[type='checkbox'] {
  border-radius: var(--radius-md);
}

/* Restore playlist badge */
.playlist-badge {
  position: absolute;
  top: -1.25rem;
  right: 0.5rem;
  background: #2c3e2c;
  color: #ffffff;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.8rem;
  z-index: 1;
  opacity: 1;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.playlist-badge:not(:empty) {
  display: block;
}

/* Remove the word 'Playlist' from the badge content */
.playlist-badge::after {
  content: attr(data-type);
}

/* Playlist links styling */
.playlist-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: -0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem;
}

.playlist-link {
  font-size: 0.8rem;
  color: var(--colour-accent-text);
  text-decoration: none;
  transition:
    color var(--transition-fast),
    opacity var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.playlist-link:hover {
  color: #81c784;
  text-decoration: underline;
}

.playlist-link::before {
  content: '→';
  color: var(--colour-accent-text);
}

/* YouTube playlist input styling */
.youtube-playlist-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid #444;
  border-radius: 8px;
  background: #2a2a2a;
  color: #fff;
  font-size: 1rem;
  width: 100%;
  min-width: 300px;
  transition: border-color 0.2s;
  height: 2.5rem;
}

.youtube-playlist-input:hover {
  border-color: #666;
}

.youtube-playlist-input:focus {
  outline: none;
  border-color: #72a4f2;
}

/* What's New Dialog */
.whats-new-dialog {
  border: 1px solid var(--colour-border);
  border-radius: var(--radius-xl);
  padding: 0;
  background-color: var(--colour-surface-elevated);
  color: var(--colour-text);
  max-width: 95vw;
  width: 500px;
  max-height: 80vh;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.whats-new-dialog .dialog-header {
  padding: 1rem 1.5rem 0.75rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.whats-new-dialog .dialog-header h2 {
  margin: 0;
  text-align: center;
  color: #ffffff;
  font-size: 1.25rem;
}

.whats-new-dialog .dialog-content {
  padding: 1rem 1.5rem;
  overflow-y: auto;
  max-height: 50vh;
}

.version-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.version-number {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--colour-accent);
}

.version-date {
  color: var(--colour-text-muted);
  font-size: 0.9rem;
}

.changes-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.changes-section h3 {
  color: var(--colour-accent-text);
  margin-bottom: 0.25rem;
  font-size: 1rem;
}

.changes-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.changes-section li {
  margin-bottom: 0.25rem;
  line-height: 1.3;
  position: relative;
  padding-left: 1.25rem;
}

.changes-section li::before {
  content: '•';
  color: var(--colour-accent-text);
  position: absolute;
  left: 0;
}

.changes-section li a {
  color: #72a4f2;
  text-decoration: none;
  transition: color 0.2s ease;
}

.changes-section li a:hover {
  color: #9abff5;
  text-decoration: underline;
}

.version-separator {
  margin: 0.5rem 0;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#closeWhatsNew,
#closeChangeHistory {
  background-color: #444;
  color: white;
}

#closeWhatsNew:hover,
#closeChangeHistory:hover {
  background-color: #555;
}

.whats-new-dialog .dialog-buttons {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  padding: 0.75rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0 0 16px 16px;
}

.whats-new-dialog .dialog-buttons .changelog-link {
  color: #4caf50;
  text-decoration: none;
  font-size: 0.8rem;
  padding: 0;
  margin-bottom: 0.25rem;
  border: none;
  margin-left: 0;
  padding-left: 0;
}

.whats-new-dialog .dialog-buttons button {
  width: 100%;
  min-height: 2rem;
  padding: 0.5rem 1rem;
}

.whats-new-dialog .dialog-buttons .changelog-link:hover {
  text-decoration: underline;
}

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

.sound-selection select {
  flex: 1;
}

.preview-sound {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--colour-border-strong);
  border-radius: var(--radius-sm);
  background: var(--colour-button-secondary);
  color: #fff;
  cursor: pointer;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.preview-sound:hover {
  background: var(--colour-button-secondary-hover);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.3);
}

.preview-sound:active {
  transform: scale(0.98) translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.preview-sound svg {
  width: 18px;
  height: 18px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

.preview-sound.playing {
  background: var(--colour-accent);
  border-color: rgba(255, 255, 255, 0.4);
  color: white;
  box-shadow: 0 0 12px rgba(76, 175, 80, 0.4);
}

.setting-group label.inactive {
  opacity: 0.35;
  cursor: not-allowed;
  background: rgba(0, 0, 0, 0.2);
  filter: grayscale(100%);
  position: relative;
}

.setting-group label.inactive::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    45deg,
    rgba(0, 0, 0, 0.1),
    rgba(0, 0, 0, 0.1) 10px,
    rgba(0, 0, 0, 0.2) 10px,
    rgba(0, 0, 0, 0.2) 20px
  );
  border-radius: 8px;
  pointer-events: none;
}

.setting-group label.inactive::after {
  content: attr(data-inactive-message, 'Enable "Play Music" first');
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.setting-group label.inactive:hover::after {
  opacity: 1;
}

.setting-group label.inactive input,
.setting-group label.inactive select,
.setting-group label.inactive .number-input-group {
  pointer-events: none;
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.1);
}

.setting-group label.inactive .playlist-badge {
  opacity: 0.35;
  background: rgba(0, 0, 0, 0.3);
}

.playlist-links a.inactive {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(100%);
}

.youtube-playlist-input:disabled {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
}

.change-history-dialog {
  padding: 0;
  border: none;
  border-radius: 12px;
  background-color: #1a2b1a;
  color: white;
  max-width: 600px;
  width: 90%;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  max-height: 90vh;
  display: none;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
}

.change-history-dialog[open] {
  display: flex;
  opacity: 1;
  visibility: visible;
}

.change-history-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
}

.change-history-dialog .dialog-content {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.whats-new-dialog .dialog-content,
.change-history-dialog .dialog-content {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.whats-new-dialog .dialog-content::-webkit-scrollbar,
.change-history-dialog .dialog-content::-webkit-scrollbar {
  width: 8px;
}

.whats-new-dialog .dialog-content::-webkit-scrollbar-track,
.change-history-dialog .dialog-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.whats-new-dialog .dialog-content::-webkit-scrollbar-thumb,
.change-history-dialog .dialog-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

.whats-new-dialog .dialog-content::-webkit-scrollbar-thumb:hover,
.change-history-dialog .dialog-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.change-history-dialog .dialog-footer {
  flex-shrink: 0;
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0 0 12px 12px;
  display: flex;
  justify-content: center;
}

.change-history-dialog .dialog-footer button {
  min-height: 2.5rem;
  padding: 0.75rem 2rem;
}

.portrait-warning-dialog {
  padding: 0;
  border: none;
  border-radius: 12px;
  background-color: #1a2b1a;
  color: white;
  max-width: 400px;
  width: 90%;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  opacity: 0;
  visibility: hidden;
  display: none;
}

.portrait-warning-dialog[open] {
  opacity: 1;
  visibility: visible;
  display: block;
}

.portrait-warning-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
}

.portrait-warning-dialog .dialog-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.portrait-warning-dialog h2 {
  margin: 0;
  color: var(--colour-accent);
  font-size: 1.5rem;
}

.portrait-warning-dialog p {
  margin: 0;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
}

.portrait-warning-dialog .dialog-footer {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}

.portrait-warning-dialog button {
  background-color: var(--colour-accent-button);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  transition: background-color var(--transition-fast);
}

.portrait-warning-dialog button:hover {
  background-color: var(--colour-accent-button-hover);
}

/* Settings Tabs */
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}

.tab-button {
  flex: 0 0 calc((100% - 1.5rem) / 4);
  min-width: 0;
  background: none;
  border: none;
  color: var(--colour-text-muted);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
  font-size: 0.95rem;
}

.tab-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.tab-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.4);
}

.tab-button.active {
  background: var(--colour-accent-button);
  color: white;
}

/* Settings Panels */
.settings-panels {
  overflow-y: auto;
  flex: 1;
}

.settings-panel {
  display: none;
  flex-direction: column;
  gap: 1rem;
}

.settings-panel.active {
  display: flex;
}

.bottom-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  width: 100%;
  position: fixed;
  bottom: 0.1rem;
  left: 0;
  right: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--colour-border);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.2);
}

/* Read-only join code. It sits on the bar's padding box, so it stays just
   above the controls as the bar's height changes. */
.companion-join {
  position: absolute;
  z-index: 1;
  right: 1rem;
  bottom: calc(100% + 0.45rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  width: max-content;
  max-width: calc(100vw - 1.5rem);
  margin: 0;
  padding: 0.4rem 0.7rem 0.35rem;
  text-align: center;
  background: rgba(16, 14, 12, 0.94);
  border: 1px solid rgba(212, 175, 55, 0.55);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* The badge is informational. Clicks pass through to any day preset it covers. */
.companion-join,
.companion-join * {
  pointer-events: none;
}

.companion-join[hidden] {
  display: none !important;
}

.companion-join.is-reconnecting {
  border-color: rgba(255, 255, 255, 0.22);
}

.companion-join-label,
.companion-join-state {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.1;
  color: #f3ecda;
}

.companion-join-label {
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.companion-join-state {
  letter-spacing: 0.04em;
}

.companion-join-code {
  margin: 0;
  font-family: 'Azeret Mono', ui-monospace, 'Cascadia Mono', monospace;
  font-weight: 600;
  font-size: clamp(1.35rem, 2.5vw, 2.15rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.14em;
  line-height: 1.05;
  color: var(--colour-gold-bright);
  white-space: nowrap;
}

@media (max-width: 520px), (max-height: 480px) {
  .companion-join {
    right: 0.45rem;
    bottom: calc(100% + 0.3rem);
    gap: 0.08rem;
    padding: 0.28rem 0.45rem 0.22rem;
  }

  .companion-join-label,
  .companion-join-state {
    font-size: 0.62rem;
  }

  .companion-join-code {
    font-size: 1.2rem;
    letter-spacing: 0.1em;
  }
}

.left-buttons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-left: 1rem;
}

.timer-buttons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.right-buttons {
  display: flex;
  align-items: center;
  margin-right: 1rem;
}

.timer-buttons button {
  padding: 8px 16px;
  font-size: 1.1rem;
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast);
  min-height: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Keyboard Shortcuts Styles */
.shortcuts-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* Make the 6th shortcut (Open Info) span both columns */
.shortcut-item:nth-child(6) {
  grid-column: 1 / -1;
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.shortcut-item label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0;
  font-weight: 500;
  font-size: 0.9rem;
}

.shortcut-item span {
  flex: 1;
  margin-right: 0.75rem;
}

.shortcut-input {
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: white;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  text-align: center;
  min-width: 100px;
  max-width: 120px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.shortcut-input:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.shortcut-input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.shortcut-input.recording {
  background-color: rgba(255, 193, 7, 0.2);
  border-color: #ffc107;
  animation: pulse 1s infinite;
}

.shortcut-input.shortcut-conflict {
  background-color: rgba(220, 53, 69, 0.2);
  border-color: #dc3545;
  animation: shake 0.5s ease-in-out;
}

/* Opacity pulse shared by the current-day preset and shortcut recording. */
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-2px);
  }
  75% {
    transform: translateX(2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .timer-display.wake-up-countdown .time,
  .clocktower-presets button.current-day,
  .shortcut-input.recording,
  .shortcut-input.shortcut-conflict {
    animation: none;
  }
}

.shortcut-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.shortcut-actions .secondary-btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.shortcut-actions .secondary-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Make the shortcuts panel more compact */
.settings-panel[data-panel='shortcuts'] {
  gap: 0.75rem;
}

.settings-panel[data-panel='shortcuts'] .setting-group {
  gap: 0.75rem;
}

#companionAutoStartLabel.is-unavailable {
  opacity: 0.45;
}

.companion-intro,
.companion-hint,
#companionCopyFeedback {
  margin: 0;
  color: var(--colour-text-muted);
  font-size: 0.9rem;
}

#companionStatus {
  margin: 0;
  font-weight: 600;
}

#companionCodeRow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin: 0;
}

#companionCodeRow[hidden],
#companionSession[hidden],
#companionQr[hidden] {
  display: none;
}

#companionCode,
#companionQrCode {
  font-family: 'Azeret Mono', ui-monospace, monospace;
  font-weight: 600;
  letter-spacing: 0.14em;
}

#companionCode {
  font-size: 1.75rem;
  color: var(--colour-gold-bright);
}

.companion-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.companion-actions button,
#companionQrClose {
  width: auto;
  padding: 0.45rem 0.8rem;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: white;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

.companion-actions button.primary-btn {
  background: var(--colour-accent-button);
  border-color: transparent;
}

.companion-actions button:disabled,
#companionQrClose:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.companion-actions button:focus-visible,
#companionQrClose:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.4);
}

.companion-qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  padding: 0.75rem;
  border-radius: 8px;
  background: #fff;
  color: #111;
}

.companion-qr-card img {
  width: min(16rem, 100%);
  height: auto;
  background: #fff;
}

#companionQrCode {
  margin: 0;
  font-size: 1.25rem;
  color: #111;
}

/* Responsive adjustments.
   Shorter height queries follow the taller ones, so both can match and the
   shorter query wins. Change History keeps its own size: the short-screen
   What's New rules used to be followed by Change History's base rules, which
   cancelled the shared dialog sizing. */
@media (max-width: 520px) {
  .tab-button {
    flex-basis: calc((100% - 0.5rem) / 2);
  }
}

@media (max-width: 640px) {
  .info-dialog {
    max-width: 95vw;
  }

  .info-dialog-main {
    flex-direction: column;
    gap: 1rem;
  }

  .qr-code-column {
    align-items: center;
  }

  .qr-code-container {
    max-width: 250px;
  }
}

@media (max-height: 600px) {
  .whats-new-dialog {
    max-height: 95vh;
    width: 90vw;
    max-width: 400px;
  }

  .whats-new-dialog .dialog-header {
    padding: 0.75rem 1rem 0.5rem 1rem;
  }

  .whats-new-dialog .dialog-header h2 {
    font-size: 1.1rem;
  }

  .whats-new-dialog .dialog-content {
    padding: 0.75rem 1rem;
  }

  .whats-new-dialog .dialog-buttons {
    padding: 0.5rem 1rem;
  }

  .changes-container {
    gap: 0.75rem;
  }

  .version-separator {
    margin: 0.25rem 0;
  }

  .changes-section {
    margin-bottom: 0.75rem;
  }

  .changes-section h3 {
    font-size: 0.9rem;
    margin-bottom: 0.125rem;
  }

  .changes-section li {
    margin-bottom: 0.125rem;
    font-size: 0.85rem;
    line-height: 1.2;
    padding-left: 1rem;
  }

  .version-info {
    margin-bottom: 0.5rem;
    padding-bottom: 0.125rem;
  }

  .version-number {
    font-size: 1rem;
  }

  .version-date {
    font-size: 0.75rem;
  }

  .whats-new-dialog .dialog-buttons button {
    min-height: 1.75rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.9rem;
  }
}

@media (max-height: 480px) {
  .whats-new-dialog {
    width: 85vw;
    max-width: 350px;
  }

  .whats-new-dialog .dialog-content {
    max-height: 50vh;
    padding: 0.5rem 0.75rem;
  }

  .whats-new-dialog .dialog-header {
    padding: 0.5rem 0.75rem 0.25rem 0.75rem;
  }

  .whats-new-dialog .dialog-header h2 {
    font-size: 1rem;
  }

  .whats-new-dialog .dialog-buttons {
    padding: 0.25rem 0.75rem;
  }

  .whats-new-dialog .dialog-buttons button {
    min-height: 1.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
  }

  .version-info {
    margin-bottom: 0.25rem;
    padding-bottom: 0.125rem;
  }

  .version-number {
    font-size: 0.9rem;
  }

  .version-date {
    font-size: 0.7rem;
  }

  .changes-section h3 {
    font-size: 0.8rem;
    margin-bottom: 0.125rem;
  }

  .changes-section li {
    font-size: 0.8rem;
    margin-bottom: 0.125rem;
    line-height: 1.1;
  }

  .changes-container {
    gap: 0.5rem;
  }

  .version-separator {
    margin: 0.125rem 0;
  }
}

@media (max-height: 700px) {
  .settings-dialog {
    max-height: 95vh;
  }

  .dialog-content {
    max-height: 85vh;
  }

  .number-input-group {
    gap: 0.35rem;
  }

  .number-input-group button {
    width: 28px;
    height: 28px;
  }

  .sound-selection {
    gap: 6px;
  }

  .preview-sound {
    width: 28px;
    height: 28px;
  }

  .setting-group select,
  .setting-group input[type='text'],
  .setting-group input[type='number'] {
    padding: 0.35rem;
    font-size: 0.9rem;
    min-width: 100px;
  }

  .settings-tabs {
    padding-bottom: 0.35rem;
    margin-bottom: 0.35rem;
  }

  .tab-button {
    padding: 0.35rem 0.75rem;
    font-size: 0.9rem;
  }

  /* Keeps short-viewport selects in their own layer. */
  .setting-group,
  .setting-group select {
    transform: translateZ(0);
  }
}

@media (max-height: 670px) {
  .settings-dialog {
    max-height: 98vh;
  }

  .dialog-content {
    padding: 0.5rem;
    gap: 0.5rem;
    max-height: 90vh;
  }

  .setting-group {
    padding: 0.5rem;
  }

  .setting-group label {
    padding: 0.15rem;
    gap: 0.5rem;
  }

  .dialog-buttons {
    margin-top: 0.35rem;
  }

  .dialog-buttons button {
    padding: 0.4rem 0.75rem;
  }

  .settings-tabs {
    padding-bottom: 0.25rem;
    margin-bottom: 0.25rem;
  }
}

@media (max-width: 400px) {
  .shortcuts-container {
    grid-template-columns: 1fr;
  }

  .shortcut-item:nth-child(6) {
    grid-column: 1;
  }
}
