/* WordCraft Daily, after the app's "Alchemist's Lab" look (ui/theme/Color.kt, Type.kt, Shape.kt, components/Alchemy.kt). */
@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/fraunces.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Karla';
  src: url('../fonts/karla.ttf') format('truetype');
  font-weight: 200 800;
  font-display: swap;
}
:root {
  --ink: #1D1A2F; --ink-chip: #2A2640; --ink-soft: #4A4360;
  --parchment: #F3EBDD; --vellum: #FBF6EC; --linen: #EADFCB; --rule: #D9CDB6; --dust: #A39B8A;
  --brass: #B8862B; --brass-light: #E2B656; --brass-deep: #7A5A1E;
  --elixir: #2E8C83; --elixir-deep: #277A72; --vermilion: #B3402A;
  --chip: #FFFCF5; --chip-border: rgba(184, 134, 43, 0.8);
  --primary-container: #D3EAE6; --on-primary-container: #12423D; --tertiary-container: #F1E1BC; --on-tertiary-container: #5C4314;
  --outline-variant: #D9CDB6; --error-container: #F6D9D0;
  --fraunces: 'Fraunces', Georgia, serif;
  --karla: 'Karla', system-ui, sans-serif;
  color-scheme: light;
}

body { background: var(--parchment); color: var(--ink); font-family: var(--karla); font-weight: 400; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 0 16px 24px; display: flex; flex-direction: column; gap: 12px; }
:focus-visible { outline: 3px solid var(--elixir); outline-offset: 2px; }
.serif, h1, h2 { font-family: var(--fraunces); font-variation-settings: 'opsz' 36, 'SOFT' 0, 'WONK' 0; font-weight: 600; }

/* ---- Top bar ---- */
.topbar { display: flex; align-items: center; gap: 4px; max-width: 640px; width: 100%; margin: 0 auto; padding: max(8px, env(safe-area-inset-top)) 8px 4px; }
.title { flex: 1; text-align: center; min-width: 0; }
.title h1 { font-size: 22px; line-height: 28px; }
.icon-btn { width: 48px; height: 48px; display: grid; place-items: center; border: 0; background: none; border-radius: 50%; color: var(--ink); flex: none; text-decoration: none; }
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn:hover { background: rgba(29, 26, 47, 0.07); }
.icon-btn.small { width: 36px; height: 36px; color: rgba(29, 26, 47, 0.7); }
.icon-btn.small svg { width: 20px; height: 20px; }
#sound-btn[aria-pressed='true'] .mute, #sound-btn[aria-pressed='false'] .waves { display: none; }

/* ---- Ink card (InkCard, Eyebrow, EmojiMedallion, InkCardButton, InkStat) ---- */
.ink-card { width: 100%; background: var(--ink); color: var(--parchment); border-radius: 24px; padding: 24px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.eyebrow { font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: 2px; color: var(--brass-light); }
.medallion { width: 84px; height: 84px; border-radius: 50%; background: var(--parchment); display: grid; place-items: center; font-size: 42px; line-height: 1; flex: none; }
.target-word { font-family: var(--fraunces); font-variation-settings: 'opsz' 36, 'SOFT' 0, 'WONK' 0; font-weight: 600; font-size: 36px; line-height: 42px; overflow-wrap: anywhere; }
.rule-text { font-size: 14px; line-height: 20px; color: var(--rule); }
.rule-text.small { font-size: 13px; line-height: 18px; }
.rule-text b { color: var(--parchment); }
.pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: 100%; }
.pill { background: var(--ink-chip); border: 1px solid var(--brass); border-radius: 999px; padding: 7px 13px; font-size: 14px; font-weight: 700; color: var(--parchment); }
.ink-btn {
  width: 100%; min-height: 52px; border: 0; border-radius: 14px; background: var(--elixir-deep); color: #fff; margin-top: 8px;
  font-size: 16px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.ink-btn:hover { filter: brightness(1.08); }
.ink-btn svg { width: 20px; height: 20px; }
.ink-btn.ghost { background: transparent; border: 1.5px solid rgba(217, 205, 182, 0.5); margin-top: 0; }
.ink-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; margin-top: 4px; }
.ink-btns .ink-btn { margin-top: 0; }
.ink-stats { display: flex; justify-content: space-evenly; width: 100%; margin-top: 4px; }
.ink-stat b { display: block; font-family: var(--fraunces); font-variation-settings: 'opsz' 36; font-weight: 600; font-size: 30px; line-height: 36px; white-space: nowrap; }
.ink-stat b.brass { color: var(--brass-light); }
.ink-stat span { font-size: 13px; color: var(--rule); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3.5px solid rgba(226, 182, 86, 0.25); border-top-color: var(--brass-light); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Hub stat tiles (DailyScreen StatTile) ---- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.tile { background: var(--vellum); border: 1px solid var(--outline-variant); border-radius: 20px; padding: 12px 4px; text-align: center; }
.tile b { display: block; font-family: var(--fraunces); font-variation-settings: 'opsz' 36; font-weight: 700; font-size: 22px; line-height: 28px; }
.tile span { font-size: 13px; color: var(--ink-soft); }
.intro { display: flex; flex-direction: column; gap: 12px; }

/* ---- Game: the table (ConnectionsCanvas + GameHudOverlay) and the inventory (WordInventory) ---- */
.game { display: flex; flex-direction: column; border-radius: 20px; overflow: hidden; border: 1px solid var(--outline-variant); background: var(--vellum); }
.board { position: relative; height: clamp(300px, 52vh, 460px); background: var(--linen); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.hud { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 4px; padding: 6px 6px 0 10px; z-index: 100000; pointer-events: none; }
.hud > * { pointer-events: auto; }
.target-pill { flex: 1; min-width: 0; display: flex; justify-content: flex-start; }
.target-pill span.inner { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; background: var(--ink); border-radius: 999px; padding: 5px 14px 5px 10px; }
.target-pill .lbl { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; color: var(--brass-light); }
.target-pill .word { font-family: var(--fraunces); font-variation-settings: 'opsz' 36; font-weight: 600; font-size: 16px; color: var(--parchment); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-right { display: flex; align-items: center; gap: 2px; }
.combos { display: flex; flex-direction: column; align-items: center; padding: 0 6px; min-width: 44px; }
.combos b { font-family: var(--fraunces); font-variation-settings: 'opsz' 36; font-weight: 600; font-size: 22px; line-height: 22px; }
.combos span { font-size: 11px; color: rgba(29, 26, 47, 0.7); }
.combos b.bump { animation: bump 0.35s ease-out; }
@keyframes bump { 40% { transform: scale(1.3); color: var(--elixir-deep); } }
.board-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-size: 14px; line-height: 20px; color: rgba(74, 67, 96, 0.5); padding: 0 24px; pointer-events: none; }
.trash { position: absolute; left: 50%; bottom: 12px; width: 48px; height: 48px; margin-left: -24px; border-radius: 50%; background: var(--error-container); color: #5E1B10; display: grid; place-items: center; z-index: 99999; transition: background 0.15s, transform 0.15s; }
.trash svg { width: 24px; height: 24px; }
.trash.hot { background: var(--vermilion); color: #fff; transform: scale(1.12); }

/* A word on the table (DraggableWordChip) */
.word-chip {
  position: absolute; left: 0; top: 0; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  background: var(--chip); border: 1.5px solid var(--chip-border); border-radius: 999px; padding: 9px 14px;
  font-size: 16px; line-height: 22px; font-weight: 700; color: var(--ink); box-shadow: 0 1px 3px rgba(29, 26, 47, 0.2);
  cursor: grab; touch-action: none; transition: background-color 0.9s 0.3s, border-color 0.9s 0.3s, color 0.9s 0.3s;
}
.word-chip.dragging { cursor: grabbing; box-shadow: 0 6px 16px rgba(29, 26, 47, 0.25); transition: none; }
.word-chip.removing { opacity: 0.45; }
.word-chip.combining { background: var(--primary-container); border-color: var(--elixir-deep); color: var(--on-primary-container); transition: none; }
.word-chip.combining::before { content: ''; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(39, 122, 114, 0.25); border-top-color: var(--elixir-deep); animation: spin 0.8s linear infinite; }
.word-chip.hover-target { border-color: var(--elixir-deep); box-shadow: 0 0 0 3px rgba(46, 140, 131, 0.25); }
/* A fresh discovery arrives inked and pops in, then settles into a brass-rimmed chip. */
.word-chip.inked { background: var(--ink); border-color: var(--ink); color: var(--parchment); transition: none; }
.word-chip.fresh { animation: pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes pop { from { scale: 0; } }

/* The inventory */
.inventory { display: flex; flex-direction: column; border-top: 1px solid var(--outline-variant); }
.inv-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; }
.inv-bar input { flex: 1; min-width: 0; height: 44px; border-radius: 14px; border: 1px solid #8F8370; background: transparent; padding: 0 14px; font-size: 13px; font-family: var(--karla); }
.inv-bar input:focus { outline: 2px solid var(--elixir-deep); outline-offset: -1px; border-color: transparent; }
#sort-btn[aria-pressed='true'] { color: var(--elixir-deep); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 12px 14px; min-height: 120px; max-height: 38vh; overflow-y: auto; align-content: flex-start; }
.inv-chip {
  border: 1px solid rgba(184, 134, 43, 0.48); background: var(--chip); color: var(--ink); border-radius: 999px; padding: 7px 10px;
  font-size: 14px; line-height: 20px; font-weight: 600; white-space: nowrap; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.inv-chip:hover { border-color: var(--brass); }
.inv-chip.new { background: var(--ink); color: var(--parchment); border-color: var(--ink); }
.inv-chip.held { opacity: 0.4; }
.chips .none { font-size: 14px; color: var(--ink-soft); padding: 8px 2px; }
/* The chip following the pointer on a drag from the inventory (FloatingDragChip) */
.float-chip { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; box-shadow: 0 8px 22px rgba(29, 26, 47, 0.3); cursor: grabbing; transition: none; }
.float-chip.over { background: var(--primary-container); border-color: var(--elixir-deep); }

/* ---- Result (DailyResultScreen) ---- */
.result { display: flex; flex-direction: column; gap: 16px; animation: rise 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.recipe { background: var(--vellum); border: 1px solid var(--outline-variant); border-radius: 20px; padding: 14px 16px; }
.recipe h2 { font-size: 18px; line-height: 24px; margin-bottom: 6px; }
.recipe ol { list-style: none; margin: 0; padding: 0; }
.recipe li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.recipe li + li { border-top: 1px solid rgba(217, 205, 182, 0.6); margin-left: 36px; padding-left: 0; }
.recipe li + li .num { margin-left: -36px; }
.recipe .num { width: 26px; height: 26px; border-radius: 50%; background: var(--tertiary-container); color: var(--on-tertiary-container); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.recipe .from { flex: 1; min-width: 0; font-size: 14px; color: var(--ink-soft); }
.recipe .to { font-size: 14px; font-weight: 700; border: 1px solid rgba(184, 134, 43, 0.6); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.recipe .to.target { background: var(--ink); color: var(--parchment); border-color: var(--ink); }
.recipe .empty { font-size: 14px; color: var(--ink-soft); }
.btn {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; border-radius: 14px; border: 0;
  font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--elixir-deep); color: #fff; }
.btn.outline { background: transparent; border: 1.5px solid #8F8370; color: var(--ink); }
.btn:hover { filter: brightness(1.05); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Next puzzle countdown */
.countdown { border-radius: 20px; background: var(--vellum); border: 1px solid var(--outline-variant); padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.countdown p { font-size: 12px; font-weight: 700; letter-spacing: 2px; color: var(--brass-deep); }
.clock { display: flex; align-items: center; gap: 6px; }
.clock span { font-family: var(--fraunces); font-variation-settings: 'opsz' 36; font-weight: 600; font-size: 26px; background: var(--chip); border: 1px solid var(--outline-variant); border-radius: 12px; padding: 2px 10px; min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.clock i { font-style: normal; font-size: 22px; color: var(--brass); }
.track { width: 100%; height: 4px; border-radius: 2px; background: rgba(184, 134, 43, 0.15); overflow: hidden; }
.track b { display: block; height: 100%; background: var(--brass); }

.app-cta { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 20px; background: var(--vellum); border: 1px solid var(--outline-variant); }
.app-cta img { width: 60px; height: 60px; border-radius: 14px; flex: none; }
.app-cta div { display: flex; flex-direction: column; gap: 4px; }
.app-cta b { font-family: var(--fraunces); font-variation-settings: 'opsz' 36; font-weight: 600; font-size: 18px; }
.app-cta p { font-size: 14px; color: var(--ink-soft); }
.play-badge { align-self: flex-start; margin-top: 4px; padding: 8px 14px; border-radius: 12px; background: #1D2433; color: #fff; text-decoration: none; font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.play-badge svg { width: 18px; height: 18px; }

/* ---- Dialogs, snackbar, toast, footer ---- */
.dialog { border: 0; border-radius: 28px; padding: 24px; width: min(420px, calc(100vw - 32px)); background: var(--vellum); color: var(--ink); box-shadow: 0 16px 40px rgba(29, 26, 47, 0.3); }
.dialog::backdrop { background: rgba(29, 26, 47, 0.45); }
.dialog h2 { font-size: 24px; line-height: 30px; margin-bottom: 10px; }
.dialog ul { margin: 0 0 16px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.dialog .demo { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; font-weight: 700; font-size: 14px; }
.dialog .demo .inv-chip { padding: 5px 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.text-btn { border: 0; background: none; color: var(--elixir-deep); font-weight: 700; font-size: 15px; padding: 10px 14px; border-radius: 12px; }
.text-btn:hover { background: rgba(39, 122, 114, 0.08); }
.snackbar { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 60; width: max-content; max-width: calc(100vw - 32px); padding: 14px 18px; border-radius: 8px; background: #322F35; color: #F5EFF7; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.snackbar.show { opacity: 1; transform: translate(-50%, 0); }
.toast { position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px); z-index: 60; padding: 12px 18px; border-radius: 12px; background: var(--ink); color: var(--parchment); font-weight: 700; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.site-footer { max-width: 640px; margin: 0 auto; padding: 16px 16px 32px; font-size: 12px; color: var(--ink-soft); text-align: center; }
.site-footer a { color: var(--elixir-deep); }

/* ---- Past puzzles (archive/, DailyArchiveScreen) ---- */
.archive { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; }
.archive .intro-text { color: var(--ink-soft); text-align: center; font-size: 15px; }
.archive-list { display: flex; flex-direction: column; gap: 8px; }
.day-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 20px; background: var(--vellum); border: 1px solid var(--outline-variant); text-decoration: none; color: var(--ink); }
.day-row:hover { border-color: var(--brass); }
.day-row .n { font-family: var(--fraunces); font-variation-settings: 'opsz' 36; font-weight: 600; font-size: 18px; }
.day-row .date { font-size: 14px; color: var(--ink-soft); flex: 1; }
.day-row .state { font-size: 14px; font-weight: 700; color: var(--elixir-deep); }
.day-row .state.done { color: var(--brass-deep); }
.day-row.today { background: var(--ink); color: var(--parchment); border-color: var(--ink); }
.day-row.today .date { color: var(--rule); }
.day-row.today .state { color: var(--brass-light); }
.archive .more { text-align: center; font-size: 14px; color: var(--ink-soft); }
.archive .more a { color: var(--elixir-deep); font-weight: 700; }

@media (max-width: 380px) {
  .word-chip { font-size: 15px; padding: 8px 12px; }
  .ink-stat b { font-size: 26px; }
}
