/* ============================================================
   Wodol — Jwèt Mo Kreyòl
   CSS Custom Properties — Dark mode default
   ============================================================ */

:root {
  /* Game colors */
  --color-correct:     #538d4e;
  --color-present:     #b59f3b;
  --color-absent:      #3a3a3c;
  /* Colorblind variants */
  --color-correct-cb:  #f5793a;
  --color-present-cb:  #85c0f9;

  /* Tiles */
  --color-tile-text:          #ffffff;
  --color-tile-border-empty:  #3a3a3c;
  --color-tile-border-filled: #565758;

  /* Keys */
  --color-key-bg:    #818384;
  --color-key-text:  #ffffff;

  /* App chrome */
  --color-bg:           #121213;
  --color-text:         #ffffff;
  --color-header-bg:    #121213;
  --color-header-border:#3a3a3c;
  --color-modal-bg:     #1a1a1b;
  --color-hr:           #3a3a3c;

  /* Toast */
  --color-toast-bg:   #ffffff;
  --color-toast-text: #000000;

  --font-main: 'Clear Sans', 'Helvetica Neue', Arial, sans-serif;
  --header-height: 56px;
  --max-width: 500px;

  /* Keyboard: 3 rows × key-height + 3 × 8px gap + 8px bottom padding */
  --key-height: 58px;
  --keyboard-height: calc(3 * var(--key-height) + 3 * 8px + 8px);

  /*
   * Tile size: derived from available viewport height so board + keyboard
   * always fit in one screen at any desktop or mobile viewport.
   * 41px = 16px game-container vertical padding + 25px (5 row-gaps × 5px).
   */
  --tile-size: min(65px, calc((100dvh - var(--header-height) - var(--keyboard-height) - 41px) / 6));
}

/* Shrink keyboard on short screens so board fits without scrolling */
@media (max-height: 700px) {
  :root {
    --key-height: 50px;
  }
}

@media (max-height: 620px) {
  :root {
    --key-height: 44px;
  }
}

/* Light theme */
[data-theme="light"] {
  --color-correct:     #6aaa64;
  --color-present:     #c9b458;
  --color-absent:      #787c7e;

  --color-tile-text:          #ffffff;
  --color-tile-border-empty:  #d3d6da;
  --color-tile-border-filled: #878a8c;

  --color-key-bg:   #d3d6da;
  --color-key-text: #1a1a1b;

  --color-bg:            #ffffff;
  --color-text:          #1a1a1b;
  --color-header-bg:     #ffffff;
  --color-header-border: #d3d6da;
  --color-modal-bg:      #ffffff;
  --color-hr:            #d3d6da;

  --color-toast-bg:   #1a1a1b;
  --color-toast-text: #ffffff;
}

/* ============================================================
   Reset
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Lock to visible viewport — prevents scroll on mobile */
  height: 100dvh;
  height: 100vh; /* fallback for older browsers */
  height: 100dvh;
  overflow: hidden;
  transition: background 0.2s, color 0.2s;
}

/* ============================================================
   Header
   ============================================================ */
.header {
  width: 100%;
  max-width: var(--max-width);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-header-border);
  padding: 0 12px;
  position: relative;
  flex-shrink: 0;
}

.header-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.header-title h1 {
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.header-subtitle {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-top: 1px;
}

.header-left,
.header-right {
  display: flex;
  gap: 2px;
  z-index: 1;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text);
  padding: 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:hover {
  background: var(--color-header-border);
}

/* Practice mode subtitle */
#header-subtitle[textContent="Antrennman"],
#header-subtitle:not(:empty) {
  color: var(--color-present);
}

/* ============================================================
   Toast Notifications
   ============================================================ */
#toaster {
  position: fixed;
  top: calc(var(--header-height) + 14px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: 90vw;
}

.toast {
  background: var(--color-toast-bg);
  color: var(--color-toast-text);
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 700;
  animation: toast-in 0.15s ease;
  text-align: center;
  pointer-events: auto;
}

.toast a {
  color: inherit;
  text-decoration: underline;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Game Container
   ============================================================ */
.game-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  width: 100%;
  min-height: 0; /* allow flex child to shrink below content size */
}
