/* ---------- Tokens ---------- */
:root {
  --surface: #eceae6;
  --surface-sunk: #e2dfda;   /* recessed areas: flat tint instead of inset shadows */
  --line: rgba(27,26,25,.08);
  --ink: #1b1a19;
  --ink-soft: #77716a;
  --paper: #ffffff;

  --font-display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;

  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --radius-card: 16px;

  /* Physical objects keep one soft contact shadow; everything else is flat */
  --shadow-object: 0 1px 2px rgba(40,30,20,.12), 0 6px 16px rgba(40,30,20,.10);
}

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

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

button { font: inherit; color: inherit; cursor: pointer; }

#app { min-height: 100%; }

.surface { background: var(--surface); }

.sunk {
  background: var(--surface-sunk);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* Small uppercase label printed on the surface */
.engraved {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .74rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* Round/pill secondary button */
.soft-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: 44px; min-width: 44px;
  padding: 0 1em;
  border: 0;
  border-radius: 999px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .15s var(--ease-out), background .15s;
}
.soft-btn:active { transform: scale(.96); background: var(--surface-sunk); }

/* Primary action */
.key-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 52px;
  padding: 0 1.6em;
  border: 0;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  color: #fff;
  background: var(--ink);
  transition: transform .12s var(--ease-out), opacity .12s;
}
.key-btn:active { transform: scale(.97); opacity: .9; }

.link-btn {
  background: none; border: 0; padding: .6em;
  color: inherit; opacity: .7;
  font-weight: 600;
}

.soft-btn:focus-visible, .key-btn:focus-visible, .link-btn:focus-visible {
  outline: 3px solid #4b4dff; outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Moving between pages (lobby ↔ game) cross-fades instead of flashing white */
@view-transition { navigation: auto; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* ---------- Language ---------- */
/* Native <select> laid over a soft button, so the menu is the system's own */
.lang {
  position: relative;
  display: inline-grid; place-items: center;
  min-width: 44px; min-height: 44px;
  padding: 0 .9em;
  border-radius: 999px;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line);
}
.lang__current { display: inline-flex; align-items: center; gap: .45em; }
.lang__current svg { width: 18px; height: 18px; }
.lang__current svg:last-child { width: 14px; height: 14px; opacity: .6; }
.lang__short { display: none; }
@media (max-width: 520px) {
  .lang { padding: 0 .75em; }
  .lang__current { gap: .3em; }
  .lang__current svg:first-child { display: none; }
  .lang__name { display: none; }
  .lang__short { display: inline; }
}
.lang__select {
  position: absolute; inset: 0;
  width: 100%;
  opacity: 0;
  font: inherit;
  cursor: pointer;
}
.lang:focus-within { outline: 3px solid #4b4dff; outline-offset: 3px; }

/* Suggestion to switch to the browser's language: a small card at the bottom */
.lang-hint {
  position: fixed; z-index: 20;
  left: 50%; bottom: max(16px, env(safe-area-inset-bottom));
  translate: -50% 0;
  width: min(calc(100% - 32px), 420px);
  display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px 10px;
  padding: 14px 14px 12px 18px;
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow-object), inset 0 0 0 1px var(--line);
  animation: lang-hint-in .35s var(--ease-out) both;
}
.lang-hint__text { flex: 1 1 100%; font-weight: 600; }
.lang-hint .key-btn { min-height: 40px; padding: 0 1.1em; font-size: .92rem; text-decoration: none; }
.lang-hint .link-btn { padding: .4em; font-size: .9rem; }
.lang-hint--top { bottom: auto; top: max(12px, env(safe-area-inset-top)); }
.lang-hint.is-closing { animation: lang-hint-out .25s ease-in both; }
@keyframes lang-hint-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes lang-hint-out { to { opacity: 0; transform: translateY(12px); } }
