@font-face {
  font-family: 'DM Sans';
  src: url('fonts/dm-sans-latin-wght-normal.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
}

@font-face {
  font-family: 'Barlow Condensed';
  src: url('fonts/barlow-condensed-latin-700-normal.woff2') format('woff2');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: 'Rubik';
  src: url('fonts/rubik-latin-800-italic.woff2') format('woff2');
  font-style: italic;
  font-weight: 800;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --line: #b8865c42;
  --line-gold: #d7a67586;
  --cream: #fbeddc;
  --muted: #cfbba9;
  --gold: #e8ba84;
  --gold-light: #ffdeb3;
  --radius: 18px;
  --glass: linear-gradient(150deg, #bc8d6031, #38251b12 68%), #21181392;
  --glass-shadow: inset 0 1px #ffdeb515, 0 14px 35px #10070553;
  --display: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  --body: 'DM Sans', 'Trebuchet MS', Arial, sans-serif;
  --gutter: clamp(14px, 3.25vw, 46px);
  --game-width: 1220px;
  --header-height: 91px;
  font-family: var(--body);
  text-transform: uppercase;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--cream);
  background: radial-gradient(ellipse at 50% 28%, #a9683b33, transparent 63%),
    linear-gradient(180deg, #190f0ac9, #100b09eb),
    #17110e url('madera.jpg') center / cover fixed;
}

[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; text-transform: inherit; }
img { display: block; max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 4px; }
h1, h2, p { margin: 0; }

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

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid #bc90665c;
  border-radius: 9px;
  color: var(--cream);
  background: linear-gradient(180deg, #ba8c6038, #38291f36), #2c201b57;
  box-shadow: inset 0 1px #ffe1bc14;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .065em;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .18s, border-color .18s, box-shadow .18s;
}

.button:not(:disabled):hover {
  border-color: var(--gold);
  background-color: #ad784844;
}

.button:disabled { opacity: .44; cursor: default; }
.button img { flex: none; filter: brightness(0) invert(.88) sepia(.24); }
.button[aria-pressed="true"] { border-color: var(--line-gold); }

.button.primary {
  border-color: #e5aa71b3;
  color: #fff4e1;
  background: linear-gradient(180deg, #b37d46b0, #714229ad), #7547207d;
  box-shadow: inset 0 1px #fff0d33d, 0 7px 20px #160a0561;
}
.button.primary:not(:disabled):hover { background-color: #c18950a6; box-shadow: inset 0 1px #fff0d34a, 0 7px 24px #0403036e; }
.button.compact { min-height: 40px; padding: 8px 11px; font-size: .75rem; }

.game-header {
  display: grid;
  grid-template-columns: minmax(177px, 1fr) minmax(0, auto) minmax(177px, 1fr);
  gap: 12px;
  align-items: center;
  min-height: var(--header-height);
  padding: 6px max(var(--gutter), calc((100% - var(--game-width)) / 2));
  border-bottom: 1px solid var(--line);
  background: #1a120e7d;
  backdrop-filter: blur(13px);
}

.game-header h1, .games-intro h1 {
  color: var(--gold-light);
  font: 700 clamp(2.15rem, 3.5vw, 3.55rem) / .99 var(--display);
  letter-spacing: .065em;
  text-align: center;
  text-wrap: balance;
}

.header-leading { display: flex; align-items: center; gap: clamp(10px, 1.45vw, 20px); }

.fogon-logo {
  display: grid;
  justify-items: center;
  width: var(--logo-width, 75px);
  container-type: inline-size;
}

.fogon-logo img { width: 100%; height: auto; }

.fogon-logo__games {
  width: max-content;
  margin-top: .75cqi;
  padding-inline-start: .105em;
  color: #f8cc98;
  font: italic 800 19.75cqi / .96 'Rubik', var(--body);
  letter-spacing: .105em;
  transform: rotate(-6deg);
}

.game-brand { flex: none; }
.back-button { min-height: 38px; padding: 7px 12px; font-size: .73rem; }
.back-button::before {
  width: .38rem;
  height: .38rem;
  border-bottom: 1.5px solid currentColor;
  border-left: 1.5px solid currentColor;
  transform: rotate(45deg);
  content: '';
}

.header-actions { display: flex; gap: 7px; justify-content: flex-end; }
.icon-button { width: 43px; height: 43px; min-height: 0; padding: 0; }
.icon-button[aria-pressed="false"]#sound-button img { opacity: .48; }

.game-main {
  width: min(var(--game-width), 100% - 2 * var(--gutter));
  margin-inline: auto;
  padding-block: clamp(15px, 2.8vw, 32px);
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--glass);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(12px);
}

.section-label {
  color: var(--gold);
  font-size: clamp(.65rem, 1.1vw, .75rem);
  font-weight: 750;
  letter-spacing: .14em;
  line-height: 1.25;
}

.game-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.muted, .help { color: var(--muted); }
.help { line-height: 1.55; font-size: .78rem; letter-spacing: .035em; }

.games-home {
  display: grid;
  align-content: center;
  gap: clamp(17px, 4.6vh, 44px);
  width: min(1060px, 100% - 2 * var(--gutter));
  min-height: 100svh;
  padding-block: 24px 35px;
  margin-inline: auto;
}

.games-intro { display: grid; justify-items: center; gap: clamp(8px, 2vh, 18px); }
.games-intro h1 { font-size: clamp(2.4rem, 5.55vw, 5.45rem); letter-spacing: .055em; }
.home-logo {
  --logo-width: clamp(106px, 17vh, 155px);
  filter: drop-shadow(0 5px 16px #0009);
}

.game-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(12px, 2.4vw, 28px); }
.game-card {
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--cream);
  background: var(--glass);
  text-decoration: none;
  text-align: center;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(12px);
  transition: border-color .2s, box-shadow .2s;
}

.game-card:hover { border-color: var(--line-gold); box-shadow: var(--glass-shadow), 0 0 22px #d5a06c19; }
.card-art {
  position: relative;
  overflow: hidden;
  height: clamp(140px, 25vh, 236px);
  border-bottom: 1px solid var(--line);
  background: radial-gradient(ellipse at 50% 75%, #c7864c32, transparent 71%);
}
.card-art img {
  position: absolute;
  inset: 11px;
  width: calc(100% - 22px);
  height: calc(100% - 22px);
  object-fit: contain;
  filter: drop-shadow(0 9px 12px #08050382);
}
.card-content {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  justify-items: center;
  container-type: inline-size;
  gap: 11px;
  padding: clamp(15px, 2.5vw, 28px);
}
.card-content h2 {
  color: var(--gold-light);
  font: 700 clamp(2rem, 3.3vw, 3.15rem) / 1 var(--display);
  letter-spacing: .05em;
}
.card-content p {
  width: max-content;
  color: var(--muted);
  font: 700 min(1rem, 3.6cqi) / 1.35 var(--display);
  letter-spacing: .035em;
  white-space: nowrap;
}
.card-content .button { min-width: 152px; }
.game-card:hover .button.primary { border-color: var(--gold-light); }

dialog {
  width: min(620px, 100% - 24px);
  max-height: min(90vh, 800px);
  max-height: min(90dvh, 800px);
  margin: auto;
  padding: clamp(16px, 3vw, 30px);
  border: 1px solid var(--line-gold);
  border-radius: var(--radius);
  color: var(--cream);
  background: linear-gradient(145deg, #74492666, #24181320 65%), #201612e6;
  backdrop-filter: blur(20px);
  box-shadow: 0 24px 75px #000b, inset 0 1px #ffdeb515;
}

dialog::backdrop { background: #0e0909b0; backdrop-filter: blur(5px); }
dialog h2 { margin-bottom: .55em; color: var(--gold-light); font: 700 1.9rem / 1.06 var(--display); letter-spacing: .045em; }
dialog form > p + .dialog-actions { margin-top: 16px; }
dialog p { line-height: 1.5; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.announcement-dialog { text-align: center; }
.announcement-dialog .dialog-actions { justify-content: center; }

.field { display: grid; gap: 6px; margin-block: 14px 0; }
.field label, .mode-fields legend { font-weight: 700; color: var(--gold-light); }
input[type="number"], input[type="search"], input[type="text"], textarea, select {
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line-gold);
  border-radius: 8px;
  color: var(--cream);
  background: #170f0cc2;
}

textarea { width: 100%; resize: vertical; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--gold); }
.check-field { display: flex; align-items: baseline; gap: 7px; margin-top: 13px; }
.mode-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0; padding: 0; border: 0; }
.mode-fields legend { padding: 0 0 7px; }
.mode-fields label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.mode-fields input { margin: 0; }

.form-error { color: #ffbfb2; margin-top: 10px; }
.file-button { position: relative; overflow: hidden; }
.file-button:focus-within { outline: 2px solid var(--gold-light); outline-offset: 4px; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.toast {
  position: fixed;
  z-index: 2;
  inset: auto 12px 16px auto;
  max-width: min(370px, calc(100% - 24px));
  padding: 12px 17px;
  border: 1px solid var(--line-gold);
  border-radius: 10px;
  color: var(--cream);
  background: #302015db;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 25px #0009;
  font-size: .82rem;
}

@media (min-width: 780px) and (max-height: 800px) {
  :root { --header-height: 78px; }
  .game-brand { --logo-width: 66px; }
  .game-header h1 { font-size: clamp(2rem, 3.5vw, 2.9rem); }
  .game-main { padding-block: 14px; }
}

@media (max-width: 700px) {
  :root { --header-height: 104px; }
  .game-header {
    grid-template: "logo back actions" auto "title title title" auto / minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 7px 9px;
    padding-block: 8px 11px;
  }
  .header-leading { display: contents; }
  .game-brand { --logo-width: 53px; grid-area: logo; }
  .back-button { grid-area: back; }
  .game-header h1 { grid-area: title; font-size: clamp(1.38rem, 6.8vw, 2.1rem); letter-spacing: .05em; }
  .header-actions { grid-area: actions; gap: 4px; }
  .icon-button { width: 36px; height: 39px; }
  .icon-button img { width: 17px; height: 17px; }
}

@media (max-width: 640px) {
  .games-home { gap: 18px; padding-block: 20px 26px; }
  .games-intro { gap: 11px; }
  .home-logo { --logo-width: clamp(98px, 30vw, 123px); }
  .game-cards { grid-template-columns: minmax(0, 1fr); }
  .card-art { height: clamp(72px, 13svh, 117px); }
  .card-art img { inset: 7px; width: calc(100% - 14px); height: calc(100% - 14px); }
  .card-content { padding: 10px 9px 13px; gap: 7px; }
  .card-content h2 { font-size: clamp(1.65rem, 6.5vw, 2.35rem); }
  .card-content .button { min-height: 40px; }
}

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