/* ============================================================
   Scrabble Cheat Sheet — style.css
   ============================================================ */

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

:root {
  --bg:        #f5f3ee;
  --surface:   #ffffff;
  --border:    #ddd9d0;
  --border-lo: #ebe8e1;
  --text:      #1a1916;
  --muted:     #6b6860;
  --hint:      #9c9a92;

  --green-bg:  #eaf3de;
  --green-bd:  #639922;
  --green-tx:  #27500a;
  --green-dk:  #173404;

  --amber-bg:  #faeeda;
  --amber-bd:  #ba7517;
  --amber-tx:  #633806;
  --amber-dk:  #412402;

  --blue-bg:   #e6f1fb;
  --blue-tx:   #185fa5;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-tile: 'Space Mono', monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #1a1916;
    --surface:   #24231f;
    --border:    #3d3c37;
    --border-lo: #2e2d29;
    --text:      #e8e5dc;
    --muted:     #9c9a92;
    --hint:      #6b6860;

    --green-bg:  #173404;
    --green-bd:  #3b6d11;
    --green-tx:  #c0dd97;

    --amber-bg:  #412402;
    --amber-bd:  #854f0b;
    --amber-tx:  #fac775;

    --blue-bg:   #042c53;
    --blue-tx:   #85b7eb;
  }
}

html { font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

/* ---- Header ---- */
.hdr {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
}
.hdr-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: .9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.hdr-left { display: flex; align-items: center; gap: 14px; }
.logo { display: flex; gap: 3px; }
.tile-logo {
  font-family: var(--font-tile);
  font-size: 22px;
  font-weight: 700;
  width: 32px; height: 32px;
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  background: #f7d46b;
  color: #2a2400;
  border: 1.5px solid #c9a800;
  box-shadow: 0 2px 0 #a07e00;
}
.tile-logo.t2 { background: #f7e8a0; }
.tile-logo.t3 { background: #f5eed6; }

h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text);
}
.hdr p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

.print-btn {
  font-family: var(--font-body);
  font-size: 13px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.print-btn:hover { background: var(--bg); border-color: var(--muted); }

/* ---- Main ---- */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.2rem 1.5rem 2rem;
}

/* ---- Controls ---- */
.controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding-bottom: .9rem;
  border-bottom: 1px solid var(--border-lo);
  margin-bottom: .7rem;
}
.pill-group { display: flex; gap: 4px; }
.pill {
  font-family: var(--font-body);
  font-size: 13px;
  padding: 5px 13px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.pill:hover { border-color: var(--muted); color: var(--text); }
.pill.active {
  background: var(--blue-bg);
  border-color: #378add;
  color: var(--blue-tx);
  font-weight: 500;
}
.vowel-toggle.vowel-on {
  background: var(--green-bg);
  border-color: var(--green-bd);
  color: var(--green-tx);
  font-weight: 500;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 160px;
  max-width: 280px;
}
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--hint);
  pointer-events: none;
}
#search {
  width: 100%;
  font-family: var(--font-body);
  font-size: 13px;
  padding: 6px 10px 6px 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
#search:focus { border-color: #378add; }

/* ---- Legend ---- */
.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  padding: .5rem 0;
  align-items: center;
}
.leg-item { display: flex; align-items: center; gap: 5px; }
.dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot-v { background: var(--green-bd); }
.dot-r { background: var(--amber-bd); }
.dot-n { background: var(--border); }
.tip {
  margin-left: auto;
  font-style: italic;
  color: var(--hint);
}

/* ---- Count bar ---- */
.count-bar {
  font-size: 12px;
  color: var(--hint);
  padding: .25rem 0 .6rem;
}

/* ---- Sections ---- */
.section { margin-bottom: 1.4rem; }
.sec-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--hint);
  padding: .4rem 0 .35rem;
  border-bottom: 1px solid var(--border-lo);
  margin-bottom: .5rem;
}

/* ---- Card grid ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 6px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border-lo);
  border-radius: var(--radius-md);
  padding: 9px 11px;
  display: flex;
  gap: 9px;
  align-items: flex-start;
  transition: border-color .15s, box-shadow .15s;
}
.card:hover {
  border-color: var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.card.vowel-card {
  border-color: var(--green-bd);
  background: color-mix(in srgb, var(--green-bg) 50%, var(--surface));
}
.card.rare-card {
  border-color: var(--amber-bd);
  background: color-mix(in srgb, var(--amber-bg) 50%, var(--surface));
}

/* ---- Tile ---- */
.tile {
  font-family: var(--font-tile);
  font-size: 14px;
  font-weight: 700;
  min-width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: .04em;
  flex-shrink: 0;
  border-bottom: 3px solid rgba(0,0,0,.15);
}
.tile-v {
  background: #f7d46b;
  color: #2a2400;
  border-bottom-color: #b08800;
}
.tile-r {
  background: var(--amber-bg);
  color: var(--amber-tx);
  border-bottom-color: var(--amber-bd);
}
.tile-n {
  background: var(--bg);
  color: var(--text);
  border-bottom-color: var(--border);
}

/* ---- Card info ---- */
.info { flex: 1; min-width: 0; }
.word {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1.2;
}
.pts {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.def {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.45;
}
.vtag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--green-bg);
  color: var(--green-tx);
  border: 1px solid var(--green-bd);
  margin-left: 5px;
  vertical-align: middle;
  line-height: 1.6;
}

/* ---- Empty state ---- */
.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  font-size: 14px;
}
.empty span { font-size: 2rem; display: block; margin-bottom: .5rem; }

/* ---- Footer ---- */
.foot {
  max-width: 1100px;
  margin: 0 auto;
  padding: .8rem 1.5rem 2rem;
  font-size: 11px;
  color: var(--hint);
  border-top: 1px solid var(--border-lo);
}

/* ============================================================
   PRINT / PDF STYLES
   ============================================================ */
@media print {
  @page { margin: 1cm 1.2cm; size: A4; }

  body { background: #fff !important; color: #000 !important; }

  .hdr { position: static; box-shadow: none; border-bottom: 2px solid #000; }
  .print-btn, #search, .search-wrap, .controls { display: none !important; }
  .legend { margin-bottom: .4rem; }
  .tip { display: none; }

  .main { padding: .5rem 0; }

  .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }

  .card {
    border: 1px solid #ccc !important;
    background: #fff !important;
    box-shadow: none !important;
    padding: 5px 7px;
    gap: 6px;
    break-inside: avoid;
  }
  .card.vowel-card { background: #f9ffe8 !important; }
  .card.rare-card  { background: #fffbf0 !important; }

  .tile {
    min-width: 34px;
    height: 34px;
    font-size: 12px;
    border-bottom-width: 2px;
  }
  .tile-v { background: #f7d46b !important; color: #000 !important; }
  .tile-r { background: #faeeda !important; color: #633806 !important; }
  .tile-n { background: #f0ede6 !important; color: #000 !important; }

  .word { font-size: 13px; }
  .pts, .def { font-size: 11px; }

  .sec-label { font-size: 10px; padding: .2rem 0; }
  .section { margin-bottom: 1rem; }

  .count-bar { display: none; }
  .foot { border-top: 1px solid #ccc; padding: .4rem 0; }
}
