/* ============================================================
   Meeplefolio — Hex-Tile Table Focus Column theme
   deep forest felt · cream tile edges · mustard accents
   ============================================================ */

:root {
  --bg: #142e24;
  --bg-deep: #0f241b;
  --panel: #1d4433;
  --panel-2: #245743;
  --panel-3: #2b654f;
  --cream: #f3e6c4;
  --cream-dim: rgba(243, 230, 196, 0.62);
  --cream-faint: rgba(243, 230, 196, 0.14);
  --line: rgba(243, 230, 196, 0.16);
  --primary: #214d3c;
  --accent: #e0a62b;
  --accent-ink: #3a2a06;
  --teal: #43b393;
  --coral: #ef7d63;
  --graphite: #8a97a0;
  --danger: #e0715a;
  --radius: 16px;
  --radius-sm: 12px;
  --nav-h: 74px;
  --hex-tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='98' viewBox='0 0 56 98'%3E%3Cg fill='none' stroke='%23f3e6c4' stroke-opacity='.07'%3E%3Cpath d='M28 4 54 19v30L28 64 2 49V19Z'/%3E%3Cpath d='M2 49v34l26 15M54 49v34L28 98M28 64v34'/%3E%3C/g%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(67, 179, 147, 0.10), transparent 60%),
    radial-gradient(90% 50% at 50% 100%, rgba(224, 166, 43, 0.06), transparent 60%),
    var(--bg);
  color: var(--cream);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 14px;
}

/* ---------- app bar ---------- */

.appbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 2px 12px;
}

.appbar-hex {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 10px;
  background:
    var(--hex-tile),
    linear-gradient(150deg, var(--panel-3), var(--panel));
  border: 1px solid var(--line);
  position: relative;
}

.appbar-hex::after {
  content: "";
  position: absolute;
  inset: 11px;
  background: var(--accent);
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  border-radius: 3px;
}

.appbar h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.appbar-sub {
  display: block;
  font-size: 11px;
  color: var(--cream-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- views ---------- */

main {
  padding-bottom: calc(var(--nav-h) + 34px + env(safe-area-inset-bottom));
}

.view { display: none; }
.view.active { display: block; animation: rise 0.18s ease-out; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.view-title {
  margin: 18px 2px 12px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cream-dim);
}

/* ---------- felt header + pips ---------- */

.felt-header {
  margin-top: 8px;
  background:
    var(--hex-tile),
    linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  position: relative;
  overflow: hidden;
}

.felt-header::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 7px;
  height: 4px;
  border-radius: 99px;
  background: repeating-linear-gradient(90deg,
    rgba(243, 230, 196, 0.28) 0 9px,
    transparent 9px 18px);
  opacity: 0.6;
}

.pips {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.pip {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.pip-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--stage, var(--cream));
  background: transparent;
}

.pip-dot.filled { background: var(--stage, var(--cream)); }

.pip-name {
  font-size: 11px;
  color: var(--cream-dim);
  letter-spacing: 0.05em;
}

.pip-count {
  font-size: 18px;
  font-weight: 800;
  color: var(--stage, var(--cream));
  line-height: 1;
}

.felt-caption {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--cream-dim);
  text-align: center;
  letter-spacing: 0.04em;
}

/* stage helpers */

.st-setup    { --stage: var(--teal); }
.st-playing  { --stage: var(--coral); }
.st-packed   { --stage: var(--graphite); }

/* ---------- add strip ---------- */

.add-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 14px;
  min-height: 58px;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(160deg, #ecb53f, var(--accent));
  color: var(--accent-ink);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(224, 166, 43, 0.22);
}

.add-strip:active { transform: translateY(1px); }

.add-strip-plus {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(58, 42, 6, 0.18);
  font-size: 19px;
  font-weight: 700;
}

/* ---------- focus card ---------- */

.focus-card {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 18px 16px 20px;
  text-align: left;
  color: var(--cream);
  font: inherit;
  border: 1px solid rgba(224, 166, 43, 0.45);
  border-radius: 22px;
  background:
    var(--hex-tile),
    linear-gradient(150deg, var(--panel-3), var(--panel) 70%);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.focus-card:active { transform: translateY(1px); }

.focus-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.stage-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(243, 230, 196, 0.08);
  border: 1px solid var(--line);
  color: var(--stage, var(--cream));
}

.stage-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--stage, var(--cream));
}

.focus-hint {
  font-size: 11px;
  color: var(--cream-dim);
  letter-spacing: 0.05em;
}

.focus-title {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.focus-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.pill {
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(243, 230, 196, 0.07);
  font-size: 12.5px;
  font-weight: 600;
}

.focus-note {
  margin: 0;
  color: var(--cream-dim);
  font-size: 14.5px;
  overflow-wrap: anywhere;
}

.focus-card.is-empty {
  border-style: dashed;
  border-color: var(--line);
  box-shadow: none;
  text-align: center;
  padding: 26px 16px;
}

/* ---------- rows (slim felt strips) ---------- */

.group { margin-bottom: 16px; }

.group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 2px 8px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stage, var(--cream));
}

.group-title .pip-dot { width: 9px; height: 9px; }

.group-count {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--cream-dim);
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  margin-bottom: 8px;
  padding: 9px 10px 9px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  border-left: 4px solid var(--stage, var(--cream));
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
}

.hex-notch {
  flex: none;
  width: 20px;
  height: 22px;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: var(--stage, var(--cream));
  opacity: 0.9;
}

.row-main {
  flex: 1;
  min-width: 0;
  padding: 6px 2px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.row-title {
  display: block;
  font-size: 16px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--cream-dim);
  overflow-wrap: anywhere;
}

.row-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--stage, var(--cream));
}

.row-dot.filled { background: var(--stage, var(--cream)); }

.row-word { font-weight: 700; color: var(--stage, var(--cream)); }

.row-btn {
  flex: none;
  min-width: 44px;
  min-height: 44px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(243, 230, 196, 0.07);
  color: var(--cream);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.row-btn.stage-btn { color: var(--stage, var(--cream)); }

.row-btn.del-btn { font-size: 16px; padding: 6px 12px; }

.row-btn.armed {
  background: rgba(224, 113, 90, 0.22);
  border-color: var(--danger);
  color: #ffd9cf;
}

/* ---------- Log form (card sleeve) ---------- */

.sleeve {
  margin-top: 12px;
  padding: 16px 14px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    var(--hex-tile),
    linear-gradient(165deg, var(--panel-2), var(--panel));
}

.field { margin-bottom: 14px; }

.field label,
.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.field label em,
.field-label em {
  font-style: normal;
  font-weight: 500;
  color: var(--cream-dim);
  font-size: 11.5px;
  margin-left: 4px;
}

.field input[type="text"],
.field input[type="search"],
.field select,
.field textarea {
  width: 100%;
  padding: 12px 12px;
  font: inherit;
  font-size: 16px; /* prevents iOS focus zoom */
  color: var(--cream);
  background: rgba(15, 36, 27, 0.75);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--cream-dim) 50%),
                    linear-gradient(135deg, var(--cream-dim) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.field textarea { resize: vertical; min-height: 74px; }

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224, 166, 43, 0.18);
}

.field.invalid input,
.field.invalid select { border-color: var(--danger); }

.field-error {
  margin: 6px 2px 0;
  font-size: 12.5px;
  color: #ffb3a3;
}

.chip-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.chip {
  min-height: 42px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(15, 36, 27, 0.75);
  color: var(--cream);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.btn {
  flex: 1;
  min-height: 52px;
  border-radius: var(--radius-sm);
  border: 0;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(160deg, #ecb53f, var(--accent));
  color: var(--accent-ink);
  box-shadow: 0 6px 16px rgba(224, 166, 43, 0.2);
}

.btn-ghost {
  background: rgba(243, 230, 196, 0.08);
  border: 1px solid var(--line);
  color: var(--cream);
}

.btn-danger {
  background: rgba(224, 113, 90, 0.16);
  border: 1px solid rgba(224, 113, 90, 0.5);
  color: #ffd9cf;
  font-size: 14px;
  min-height: 48px;
}

.btn:active { transform: translateY(1px); }

/* ---------- Find ---------- */

.search-wrap {
  position: relative;
  margin-top: 14px;
}

.search-glyph {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-52%);
  font-size: 19px;
  color: var(--cream-dim);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  padding: 13px 14px 13px 40px;
  font: inherit;
  font-size: 16px;
  color: var(--cream);
  background: rgba(15, 36, 27, 0.75);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224, 166, 43, 0.18);
}

.search-wrap input::-webkit-search-cancel-button { -webkit-appearance: none; }

.find-heading {
  margin: 16px 2px 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream-dim);
}

/* ---------- about panel ---------- */

.about-panel {
  margin: 22px 0 6px;
  padding: 16px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(165deg, var(--panel), var(--bg-deep));
}

.about-panel h3 {
  margin: 0 0 8px;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cream-dim);
}

.about-copy {
  margin: 0 0 10px;
  font-size: 13.5px;
  color: var(--cream-dim);
}

.about-stats {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--cream);
}

.about-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------- empty states ---------- */

.empty-state {
  padding: 26px 18px 30px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 20px;
  background:
    var(--hex-tile),
    rgba(15, 36, 27, 0.4);
}

.hex-art {
  width: 92px;
  height: auto;
  display: block;
  margin: 0 auto 10px;
  color: rgba(243, 230, 196, 0.3);
}

.empty-title {
  margin: 0 0 4px;
  font-size: 15.5px;
  font-weight: 800;
}

.empty-sub {
  margin: 0;
  font-size: 13px;
  color: var(--cream-dim);
}

/* ---------- bottom tab bar ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  gap: 4px;
  max-width: 520px;
  margin: 0 auto;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(15, 36, 27, 0.96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px 4px;
  border: 0;
  background: none;
  color: rgba(243, 230, 196, 0.5);
  font: inherit;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.tab-meeple {
  width: 27px;
  height: 27px;
  fill: rgba(243, 230, 196, 0.42);
  transition: transform 0.16s ease, fill 0.16s ease;
}

.tab-btn.active {
  color: var(--accent);
}

.tab-btn.active .tab-meeple {
  fill: var(--accent);
  transform: translateY(-8px);
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.45));
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 30;
  max-width: 84vw;
  padding: 10px 16px;
  border-radius: 99px;
  background: var(--cream);
  color: #2c2007;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
  animation: rise 0.16s ease-out;
}

/* ---------- narrow screens / larger text ---------- */

@media (max-width: 350px) {
  .chip-row { grid-template-columns: repeat(4, 1fr); }
  .row-btn.stage-btn { min-width: 38px; padding: 6px 7px; }
}
