@font-face {
  font-family: 'Rozha One';
  font-style: normal;
  font-weight: 400;
  src: url('fonts/rozha-one-latin-400-normal.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 800;
  src: url('fonts/baloo-2-latin-800-normal.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Mukta';
  font-style: normal;
  font-weight: 400;
  src: url('fonts/mukta-latin-400-normal.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Mukta';
  font-style: normal;
  font-weight: 600;
  src: url('fonts/mukta-latin-600-normal.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Mukta';
  font-style: normal;
  font-weight: 800;
  src: url('fonts/mukta-latin-800-normal.woff2') format('woff2');
  font-display: swap;
}

:root {
  --room: #16121c;
  --text: #f3efe6;
  --muted: #b9b1c0;
  --line: rgba(243, 239, 230, 0.13);
  --panel: rgba(243, 239, 230, 0.05);
  --gold: #f0b54a;
  --gold-dark: #c27f17;
  --ivory: #fbf8f0;
  --ink: #141110;
  --card-red: #c0151b;
  --good: #5ccf7d;
  --bad: #f0675d;
  /* 7 Card */
  --plum: #2b1a24;
  --plum-dark: #1e1219;
  --brass: #d9a944;
  --baize: #1c6a51;
  --teak: #7a4524;
  /* 12 Cards */
  --indigo: #1a2a55;
  --indigo-dark: #0e1730;
  --saffron: #f3a03a;
  --felt: #28498b;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font: 17px/1.45 'Mukta', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
body {
  /* A plum glow from one side and an indigo one from the other: the two games' rooms. */
  background:
    radial-gradient(ellipse 70% 45% at 0% 20%, rgba(123, 30, 46, 0.32), transparent 70%),
    radial-gradient(ellipse 70% 45% at 100% 85%, rgba(40, 73, 139, 0.32), transparent 70%),
    var(--room);
  background-attachment: fixed;
}
button,
input {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}

.hub {
  width: 100%;
  max-width: 540px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(22px + var(--safe-t)) 16px calc(18px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---------- heading ---------- */

.hub-head {
  text-align: center;
}
.suits {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 20px;
  color: var(--muted);
  letter-spacing: 0;
}
.suits .red {
  color: #e2655c;
}
.hub-head h1 {
  margin: 2px 0 0;
  font-size: 40px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.lede {
  margin: 4px 0 0;
  color: var(--muted);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(243, 239, 230, 0.07);
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s;
}
.btn:active {
  transform: scale(0.97);
}
.btn.primary {
  background: linear-gradient(180deg, #f6c86e, var(--gold-dark));
  border-color: rgba(255, 228, 170, 0.5);
  color: #2a1a04;
}
.btn.ghost {
  background: transparent;
}
.btn.small {
  min-height: 40px;
  padding: 0 14px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
}

/* ---------- join with a code ---------- */

.join {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.join label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}
.join-row {
  display: flex;
  gap: 8px;
}
.code-input {
  flex: 1;
  min-width: 0;
  min-height: 56px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
  outline: none;
}
.code-input:focus {
  border-color: var(--gold);
}
.code-input::placeholder {
  color: rgba(243, 239, 230, 0.22);
}
.join .btn.primary {
  min-height: 56px;
}
.join-msg {
  margin: 8px 0 0;
  min-height: 1.45em;
  font-weight: 600;
  color: #ffb1aa;
}
.join-msg:empty {
  display: none;
}
.join-msg.info {
  color: var(--muted);
}
.join-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

/* ---------- game tiles ---------- */

.games {
  display: grid;
  gap: 14px;
}
.game {
  position: relative;
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 16px;
  align-items: center;
  padding: 22px 16px 18px;
  border-radius: 22px;
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s;
}
.game:active {
  transform: scale(0.985);
}
.game.seven {
  background: linear-gradient(160deg, #3d2333, var(--plum-dark) 70%);
  border: 1px solid rgba(217, 169, 68, 0.35);
}
.game.twelve {
  background: linear-gradient(160deg, #233a72, var(--indigo-dark) 70%);
  border: 1px solid rgba(243, 160, 58, 0.35);
}
/* 12 Cards' woven-stripe rim, as a band along the top. */
.game.twelve::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: repeating-linear-gradient(90deg, #b4532a 0 10px, #ecdfc2 10px 14px, #22356a 14px 24px, #d39b2c 24px 30px);
}

/* A little oval table with cards on it. */
.fan {
  position: relative;
  width: 108px;
  height: 84px;
  border-radius: 50%;
}
.seven .fan {
  background: radial-gradient(ellipse at 50% 40%, #2a8a68, var(--baize) 60%, #0f3f31);
  border: 4px solid var(--teak);
  box-shadow: inset 0 0 0 1px rgba(217, 169, 68, 0.6);
}
.twelve .fan {
  border: 4px solid transparent;
  background:
    radial-gradient(ellipse at 50% 40%, #3762ad, var(--felt) 60%, #142a57) padding-box,
    repeating-linear-gradient(45deg, #b4532a 0 5px, #ecdfc2 5px 8px, #22356a 8px 13px, #d39b2c 13px 17px) border-box;
}
.mini {
  --mid: calc((var(--n) - 1) / 2);
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 42px;
  margin: -24px 0 0 -15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: var(--ivory);
  color: var(--ink);
  font-weight: 800;
  font-size: 17px;
  line-height: 1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45);
  transform-origin: 50% 130%;
  transform: translateX(calc((var(--i) - var(--mid)) * 13px)) rotate(calc((var(--i) - var(--mid)) * 9deg));
}
.mini i {
  font-style: normal;
  font-size: 13px;
}
.mini.red {
  color: var(--card-red);
}
.mini.joker {
  color: #5b2a86;
}
.mini.joker i {
  font-size: 8px;
  font-weight: 800;
}

.info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: 26px; /* room for "Play" */
}
.name {
  line-height: 1.05;
}
.seven .name {
  font-family: 'Rozha One', Georgia, serif;
  font-size: 34px;
  color: var(--brass);
}
.twelve .name {
  font-family: 'Baloo 2', 'Mukta', sans-serif;
  font-weight: 800;
  font-size: 32px;
  color: var(--saffron);
}
.pitch {
  margin-top: 4px;
  font-size: 16px;
  line-height: 1.3;
}
.meta {
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
}
.status {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.status:empty {
  display: none;
}
.status::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: 1px;
  background: currentColor;
}
.status.up {
  color: var(--good);
}
.status.down {
  color: var(--bad);
}
.game.down .fan,
.game.down .go {
  opacity: 0.45;
}
.go {
  position: absolute;
  right: 14px;
  bottom: 14px;
  padding: 4px 14px;
  border-radius: 99px;
  font-weight: 800;
  font-size: 16px;
}
.seven .go {
  background: var(--brass);
  color: #2a1c05;
}
.twelve .go {
  background: var(--saffron);
  color: #2a1604;
}

/* ---------- footer ---------- */

.hub-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
}
.versions {
  margin: 0;
  font-size: 13px;
  color: rgba(185, 177, 192, 0.7);
  text-align: center;
}

/* ---------- wider screens: the two games side by side ---------- */

@media (min-width: 760px) {
  .hub {
    max-width: 880px;
    padding-top: 48px;
  }
  .join {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
  }
  .games {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- bigger text (shared with both games) ---------- */

html.large body {
  font-size: 19px;
}
html.large .hub-head h1 {
  font-size: 46px;
}
html.large .pitch {
  font-size: 19px;
}
html.large .meta,
html.large .status {
  font-size: 16px;
}
html.large .seven .name {
  font-size: 40px;
}
html.large .twelve .name {
  font-size: 38px;
}
html.large .code-input {
  font-size: 32px;
}
html.large .go {
  font-size: 18px;
}
html.large .versions {
  font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
