/* The frame every screen sits in, measured off the 1512 x 982 design:
   rail 88 | main 1104 | chat 320, top bar 28, header 88. */
.app {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 320px;
  grid-template-rows: 28px 88px minmax(0, 1fr);
  grid-template-areas:
    "top    top    chat"
    "rail   header chat"
    "rail   main   chat";
  height: 100vh;
  height: 100dvh;
}

/* ---- top bar ---- */
.topbar {
  grid-area: top;
  display: flex; align-items: center;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
}
.topbar__social { display: flex; justify-content: center; gap: 8px; width: 88px; }
.topbar__social img { opacity: 0.8; transition: opacity 0.2s, transform 0.2s; }
.topbar__social a:hover img { opacity: 1; transform: translateY(-1px); }
.topbar__links { display: flex; gap: 28px; padding-left: 32px; }
.topbar__links a, .topbar__links button {
  font-family: var(--f-link); font-weight: 500; font-size: 12px; line-height: 18px;
  text-transform: uppercase; color: var(--muted);
  transition: color 0.2s;
}
.topbar__links .is-gold, .topbar__links a:hover, .topbar__links button:hover { color: var(--gold); }

/* ---- left rail ---- */
.rail {
  grid-area: rail;
  position: relative;
  display: flex; flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--line-2);
  overflow: hidden;
  z-index: 3;
}
.rail__logo {
  flex: none; display: grid; place-items: center;
  height: 88px; background: var(--gold-soft);
}
.rail__logo img {
  box-sizing: content-box; width: 34px; height: 39px; padding: 3px 4px 4px;
  border: 1px solid var(--gold); border-radius: 50%;
  transition: transform 0.4s var(--ease-back);
}
.rail__logo:hover img { transform: rotate(-12deg) scale(1.06); }
.rail__nav { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; overflow-y: auto; scrollbar-width: none; }
.rail__nav a {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-family: var(--f-head); font-weight: 500; font-size: 14px; line-height: 21px;
  text-transform: uppercase; color: var(--muted);
  transition: color 0.2s;
}
/* Icons carry their own blue-grey; the active one turns gold, and the gold
   "main" icon turns blue-grey when another screen is open. */
.rail__nav a img { transition: filter 0.25s, transform 0.3s var(--ease-back); }
.rail__nav a[data-route="home"]:not(.is-active) img { filter: grayscale(1) brightness(0.5); }
.rail__nav a:hover { color: #d4d4d4; }
.rail__nav a:hover img { transform: translateY(-2px) scale(1.08); filter: brightness(1.6); }
.rail__nav a[data-route="home"]:not(.is-active):hover img { filter: grayscale(1) brightness(0.85); }
.rail__nav a.is-active { color: var(--gold); }
.rail__nav a.is-active:not([data-route="home"]) img { filter: var(--to-gold); }
.rail__nav .pot {
  display: grid; place-items: center;
  width: 55px; height: 23px;
  background: var(--bg-card);
  font: normal 400 10px/15px var(--f-body); color: var(--muted-2);
  transition: background 0.3s, color 0.3s;
}
.rail__nav a.is-active .pot { background: var(--gold); color: var(--ink-on-gold); }
.rail__nav .pot.is-bump { animation: pot-bump 0.5s var(--ease-back); }
@keyframes pot-bump { 40% { transform: scale(1.18); color: var(--gold); } }
.rail__nav .new {
  position: absolute; top: -10px; left: 56px;
  padding: 2px 4px; border-radius: 1px;
  background: var(--red); color: #ffffff;
  font: normal 400 8px/12px var(--f-head);
  animation: new-pulse 2s ease-in-out infinite;
}
@keyframes new-pulse { 50% { transform: scale(1.08); box-shadow: 0 0 10px rgba(255, 74, 89, 0.6); } }
.rail__info { margin: auto auto 80px; opacity: 0.7; transition: opacity 0.2s, transform 0.3s; }
.rail__info:hover { opacity: 1; transform: rotate(12deg); }

/* ---- header ---- */
.header {
  grid-area: header;
  position: relative; z-index: 4;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  background: var(--bg);
}
/* Black Ice logo: the crystal mark with a snow cap, then BLACK (white) ICE
   (gold) in the site's Oswald, slanted like the original wordmark. */
.brand { position: relative; display: flex; align-items: center; gap: 10px; height: 40px; }
.brand__mark { position: relative; flex: none; width: 34px; height: 39px; transition: transform 0.5s var(--ease-back); }
.brand__mark img:first-child { width: 34px; height: 39px; filter: drop-shadow(0 0 10px rgba(255, 199, 1, 0.25)); }
.brand__snow { position: absolute; left: 2px; top: -7px; width: 30px; height: auto; pointer-events: none; }
.brand__word { display: flex; gap: 6px; font: 700 28px/1 var(--f-head); letter-spacing: 0.01em; text-transform: uppercase; transform: skewX(-8deg); }
.brand__word b { font-weight: 700; }
.brand__word b:last-child {
  color: transparent;
  background: linear-gradient(100deg, #ffc701 0%, #ffc701 40%, #fff6c2 50%, #ffc701 60%, #ffc701 100%) 0 0 / 250% 100%;
  -webkit-background-clip: text; background-clip: text;
  animation: ice-shine 5s ease-in-out infinite;
}
@keyframes ice-shine { 0%, 70% { background-position: 100% 0; } 100% { background-position: -50% 0; } }
.brand:hover .brand__mark { transform: rotate(-10deg) scale(1.08); }
.header__icons { position: absolute; left: 50%; transform: translateX(-50%); display: flex; gap: 24px; align-items: center; }
.header__icons > * { display: grid; place-items: center; width: 20px; height: 22px; }
.header__icons img { transition: filter 0.2s, transform 0.25s var(--ease-back); }
.header__icons > *:hover img, .header__icons > .is-active img { filter: var(--to-gold); transform: scale(1.12); }
.header__right { display: flex; align-items: center; gap: 10px; }

.balance {
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px;
  background: var(--bg-btn); border-radius: 2px;
  font: 500 15px/1 var(--f-head); letter-spacing: 0.02em;
}
.balance.is-up { animation: bal-up 0.7s var(--ease-out); }
.balance.is-down { animation: bal-down 0.5s var(--ease-out); }
@keyframes bal-up { 30% { color: var(--green); transform: scale(1.06); } }
@keyframes bal-down { 30% { color: var(--red); } }

.lang { position: relative; }
.lang__btn {
  display: flex; align-items: center; gap: 8px;
  width: 96px; height: 40px; padding: 0 12px;
  background: var(--bg-btn); border-radius: 2px;
  font: 400 14px/21px var(--f-head); text-transform: uppercase;
}
.lang__chev { margin-left: auto; transform: rotate(-90deg); transition: transform 0.25s; }
.lang__btn[aria-expanded="true"] .lang__chev { transform: rotate(0deg); }
.lang__menu {
  position: absolute; top: 44px; right: 0; width: 96px; margin: 0; padding: 4px; list-style: none;
  background: var(--bg-btn); border: 1px solid var(--line); border-radius: 2px;
  animation: drop-in 0.2s var(--ease-out);
}
.lang__menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; font: 400 14px var(--f-head); border-radius: 2px; }
.lang__menu button:hover { background: var(--bg-field); }
@keyframes drop-in { from { opacity: 0; transform: translateY(-6px); } }

.burger {
  position: relative; width: 40px; height: 40px; border-radius: 2px;
  background: #ffc239 url("../assets/ui/button-stripes.jpg") left center / auto 100%;
  overflow: hidden; transition: box-shadow 0.2s;
}
.burger:hover { box-shadow: 0 0 16px rgba(255, 194, 57, 0.45); }
.burger i {
  position: absolute; left: 10px; width: 20px; height: 2px; background: #171717;
  transition: transform 0.3s var(--ease-out), opacity 0.2s;
}
.burger i:nth-child(1) { top: 13px; }
.burger i:nth-child(2) { top: 19px; }
.burger i:nth-child(3) { top: 25px; }
.burger[aria-expanded="true"] i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded="true"] i:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.chat-toggle { display: none; width: 40px; height: 40px; place-items: center; background: var(--bg-btn); border-radius: 2px; }

/* the burger menu */
.menu {
  position: fixed; z-index: 30; top: 120px; right: 352px; width: 240px;
  padding: 8px; background: var(--bg-btn); border: 1px solid var(--line); border-radius: 4px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  animation: drop-in 0.22s var(--ease-out);
}
.menu a, .menu button {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border-radius: 2px;
  font: 500 14px/21px var(--f-head); text-transform: uppercase; color: #d0d0d0; text-align: left;
}
.menu a:hover, .menu button:hover { background: var(--bg-field); color: var(--gold); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu__games { display: none; }

/* ---- main column ---- */
.main {
  grid-area: main;
  position: relative;
  overflow-y: auto; overflow-x: hidden;
  background: #171717;
  scrollbar-width: thin; scrollbar-color: #3d3d3d transparent;
  outline: none;
}
/* The art background scrolls with the content (spec: 1104 x 894 at the top). */
.screen { position: relative; padding: 32px; min-height: 100%; background: url("../assets/landing/bg-homepage.png") center top / 100% auto no-repeat; }
.screen.is-entering { animation: screen-in 0.45s var(--ease-out); }
@keyframes screen-in { from { opacity: 0; transform: translateY(14px); } }

/* scroll reveal: elements fade up as they come into view */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out); transition-delay: var(--d, 0s); }
[data-reveal].is-in { opacity: 1; transform: none; }

/* ---- snowfall across the page (the design is the winter theme) ---- */
.snowfall { position: fixed; inset: 0; z-index: 2; pointer-events: none; }

/* ---- toasts ---- */
.toasts { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 4px;
  background: #232323; border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  font: 500 14px/1.3 var(--f-head); letter-spacing: 0.02em; text-transform: uppercase;
  animation: toast-in 0.35s var(--ease-back), toast-out 0.3s ease-in 2.6s forwards;
}
.toast.is-win { border-color: rgba(74, 222, 128, 0.5); color: var(--green); }
.toast.is-loss { border-color: rgba(255, 74, 89, 0.5); color: var(--red); }
.toast.is-gold { border-color: rgba(255, 199, 1, 0.5); color: var(--gold); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---- responsive ---- */
/* Below 1280 the chat becomes a panel that slides in from the right. */
@media (max-width: 1279.98px) {
  .app {
    grid-template-columns: 88px minmax(0, 1fr);
    grid-template-areas: "top top" "rail header" "rail main";
  }
  .chat {
    position: fixed; z-index: 40; top: 0; right: 0; bottom: 0; width: min(320px, 100vw);
    transform: translateX(100%); transition: transform 0.35s var(--ease-out);
    box-shadow: -20px 0 40px rgba(0, 0, 0, 0.4);
  }
  .chat.is-open { transform: none; }
  .chat-toggle { display: grid; }
  .menu { right: 16px; }
}
/* Below 900 the header icons tuck into the burger menu. */
@media (max-width: 899.98px) {
  .header { padding: 0 16px; }
  .header__icons { display: none; }
  .balance { padding: 0 10px; }
  .lang__btn { width: auto; }
  .lang__btn span { display: none; }
}
/* Phones: the rail turns into the burger menu. (A full mobile design comes later.) */
@media (max-width: 699.98px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 64px minmax(0, 1fr);
    grid-template-areas: "header" "main";
  }
  .topbar, .rail { display: none; }
  .header { padding: 0 12px; }
  .brand__word { font-size: 22px; }
  .brand__mark, .brand__mark img:first-child { width: 28px; height: 32px; }
  .lang { display: none; }
  .menu { top: 68px; right: 12px; left: 12px; width: auto; }
  .menu__games { display: block; }
  .screen { padding: 16px; }
  .main { background-attachment: scroll; }
}

/* ---- live chat (column 320 wide) ---- */
.chat {
  grid-area: chat;
  display: flex; flex-direction: column;
  background: var(--bg);
  border-left: 1px solid var(--line-2);
  min-height: 0;
}
.chat__head { flex: none; position: relative; display: flex; align-items: center; justify-content: space-between; height: 88px; padding: 0 24px; }
.chat__head h2 { margin: 0; font: 600 20px/30px var(--f-head); text-transform: uppercase; }
.chat__online { display: flex; align-items: center; margin: 0; font: 500 14px/21px var(--f-head); text-transform: uppercase; color: var(--gold); }
.chat__online .dot { position: relative; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--gold); }
.chat__online .dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--gold); opacity: 0.75; animation: ping 1.4s cubic-bezier(0, 0, 0.2, 1) infinite; }
@keyframes ping { 75%, 100% { transform: scale(2.2); opacity: 0; } }
.chat__close { display: none; position: absolute; right: 8px; top: 8px; width: 28px; height: 28px; font-size: 22px; color: var(--muted); }

.chat__list { flex: 1; min-height: 0; overflow-y: auto; padding: 13px 24px 16px; display: flex; flex-direction: column; gap: 16px; scrollbar-width: thin; scrollbar-color: #3d3d3d transparent; }
.msg { display: flex; gap: 12px; }
.msg.is-new { animation: msg-in 0.45s var(--ease-out); }
@keyframes msg-in { from { opacity: 0; transform: translateX(16px); } }
.msg__ring { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; }
.msg__ring > span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--bg); }
.msg__ring img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.msg__body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.msg__who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.msg__who img.is-grey { filter: grayscale(1) brightness(1.3); }
.msg__who b { font-weight: 400; font-size: 14px; line-height: 21px; color: var(--muted-3); max-width: 144px; overflow: hidden; white-space: nowrap; text-overflow: clip; }
.msg__text { margin: 0; font-size: 14px; line-height: 21px; color: var(--text-chat); overflow-wrap: anywhere; }
.msg__emote { width: 28px; height: 28px; }

.chat__foot { flex: none; position: relative; height: 152px; padding: 20px 24px 0; background: var(--bg-chat-foot); }
.chat__snow { position: absolute; top: -8px; }
.chat__snow--l { left: 0; }
.chat__snow--r { right: 0; }
.chat__rooms { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.chat__rooms button {
  display: flex; align-items: center; gap: 4px; justify-content: center;
  height: 26px; border-radius: 2px; background: var(--bg-field-2);
  font-size: 12px; line-height: 18px; color: var(--muted-4); transition: color 0.2s, background 0.2s;
}
.chat__rooms button img { opacity: 0.45; transition: opacity 0.2s; }
.chat__rooms button.is-on { background: var(--bg-field); color: #ffffff; }
.chat__rooms button.is-on img, .chat__rooms button:hover img { opacity: 1; }
.chat__rooms button:hover { color: #bfbfbf; }
.chat__form { position: relative; margin-top: 8px; height: 48px; }
.chat__form textarea {
  width: 100%; height: 48px; resize: none; padding: 13px 44px 13px 14px;
  background: linear-gradient(188deg, rgba(18, 18, 18, 0.5), rgba(18, 18, 18, 0)) , var(--bg-field);
  border: 1px solid var(--line); border-radius: 4px; outline: none; font-size: 14px; line-height: 20px;
  transition: border-color 0.2s;
}
.chat__form textarea:focus { border-color: rgba(255, 199, 1, 0.5); }
.chat__emoji { position: absolute; right: 16px; top: 13px; transition: transform 0.3s var(--ease-back); }
.chat__emoji:hover { transform: rotate(18deg) scale(1.15); }
.chat__tray { position: absolute; right: 0; bottom: 54px; display: grid; grid-template-columns: repeat(4, 32px); gap: 4px; padding: 6px; background: var(--bg-field); border: 1px solid var(--line); border-radius: 4px; animation: drop-in 0.2s var(--ease-out); }
.chat__tray button { height: 32px; font-size: 18px; border-radius: 2px; }
.chat__tray button:hover { background: var(--bg-btn); }
.chat__rules { position: absolute; left: 24px; top: 114px; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 12px; line-height: 18px; }
.chat__rules-pop { position: absolute; left: 16px; bottom: 44px; width: 240px; padding: 12px 14px; background: var(--bg-field); border: 1px solid var(--line); border-radius: 4px; font-size: 12px; animation: drop-in 0.2s var(--ease-out); }
.chat__rules-pop ol { margin: 6px 0 0; padding-left: 18px; color: #bfbfbf; }
.chat__snowman { position: absolute; right: 0; bottom: -8px; transform-origin: bottom center; animation: snowman 3.2s ease-in-out infinite; }
@keyframes snowman { 50% { transform: rotate(-5deg) translateY(-2px); } }
@media (max-width: 1279.98px) { .chat__close { display: block; } }
