/* Benefits Crush — screens & board. Mobile-first; design per Swibeco DS:
   flat surfaces, thin #D7E4F2 borders, restrained motion, sentence case. */

* { box-sizing: border-box; }

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------- header */

.header {
  position: sticky; top: 0; z-index: 30;
  background: var(--sw-bg);
  border-bottom: 1px solid var(--sw-border);
  height: 64px;
  display: flex; align-items: center; gap: var(--sw-space-3);
  padding: 0 var(--sw-space-4);
}
.header__logo { height: 26px; display: block; }
.header__title {
  font-size: var(--sw-fs-sm); font-weight: 700; color: var(--sw-footer-blue);
  border-left: 1px solid var(--sw-border); padding-left: var(--sw-space-3);
  white-space: nowrap;
}
.header__spacer { flex: 1; }
.header__stats { display: flex; gap: var(--sw-space-2); align-items: center; }
.lang-select {
  font-family: var(--sw-font-sans); font-size: var(--sw-fs-xs); font-weight: 700;
  color: var(--sw-fg-3); background: transparent;
  border: 1px solid var(--sw-border); border-radius: var(--sw-radius-sm);
  padding: 4px 6px; cursor: pointer;
}

/* ---------------------------------------------------------------- layout */

.view { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: var(--sw-space-4); }
.footer {
  background: var(--sw-footer-blue); color: var(--sw-fg-inverse);
  padding: var(--sw-space-5) var(--sw-space-4);
  text-align: center;
}
.footer .sw-legal { color: rgba(255, 255, 255, 0.7); }

/* ---------------------------------------------------------------- hero */

.hero {
  background: var(--sw-bg);
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-lg);
  padding: var(--sw-space-5);
  margin-bottom: var(--sw-space-5);
  position: relative;
  overflow: hidden;
}
.hero__wave {
  position: absolute; inset: auto 0 0 0; height: 56px; pointer-events: none;
}
.hero__content { position: relative; }
.hero h2 { font-size: var(--sw-fs-h3); line-height: var(--sw-lh-h3); }
.hero__meta { display: flex; flex-wrap: wrap; gap: var(--sw-space-2); margin-top: var(--sw-space-3); }
.hero__countdown { margin-top: var(--sw-space-3); color: var(--sw-fg-3); font-size: var(--sw-fs-sm); font-weight: 500; }
.hero__countdown strong { color: var(--sw-fg-1); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- level map */

.week { margin-bottom: var(--sw-space-6); }
.week__head { display: flex; align-items: baseline; gap: var(--sw-space-3); margin-bottom: var(--sw-space-3); }
.week__title { font-size: var(--sw-fs-lg); font-weight: 700; }
.level-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: var(--sw-space-3);
}
.level-node {
  background: var(--sw-bg);
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-md);
  padding: var(--sw-space-3);
  text-align: center;
  cursor: pointer;
  transition: box-shadow var(--sw-dur) var(--sw-ease), border-color var(--sw-dur) var(--sw-ease);
  position: relative;
  min-height: 84px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-family: var(--sw-font-sans);
}
.level-node:hover { box-shadow: var(--sw-shadow-card); }
.level-node__num { font-size: var(--sw-fs-h4); font-weight: 700; color: var(--sw-fg-1); line-height: 1; }
.level-node__sub { font-size: var(--sw-fs-2xs); font-weight: 700; color: var(--sw-fg-3); }
.level-node--available { border-color: var(--sw-primary); }
.level-node--available .level-node__num { color: var(--sw-primary); }
.level-node--available .level-node__sub { color: var(--sw-primary); text-transform: uppercase; letter-spacing: 0.06em; }
.level-node--played { background: var(--sw-main-lighter); cursor: default; }
.level-node--played .level-node__sub { color: var(--sw-success); }
.level-node--locked { opacity: 0.55; cursor: default; }
.level-node--locked:hover { box-shadow: none; }
.level-node__icon { width: 16px; height: 16px; color: var(--sw-fg-4); }
.level-node--played .level-node__icon { color: var(--sw-success); }

/* ---------------------------------------------------------------- play view */

.playbar {
  display: flex; align-items: center; gap: var(--sw-space-3);
  margin-bottom: var(--sw-space-3);
}
.playbar__stat { flex: 1; }
.playbar__label { font-size: var(--sw-fs-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--sw-fg-3); }
.playbar__value { font-size: var(--sw-fs-h4); font-weight: 900; font-variant-numeric: tabular-nums; }
.playbar__value--moves { color: var(--sw-primary); }

.milestones { margin-bottom: var(--sw-space-3); }
.milestones__bar {
  height: 8px; border-radius: var(--sw-radius-pill);
  background: var(--sw-neutral-grey); position: relative; overflow: hidden;
}
.milestones__fill {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  background: var(--sw-primary); border-radius: var(--sw-radius-pill);
  transition: width 300ms var(--sw-ease);
}
.milestones__ticks { position: relative; height: 16px; }
.milestones__tick {
  position: absolute; top: 2px; transform: translateX(-50%);
  font-size: var(--sw-fs-2xs); font-weight: 700; color: var(--sw-fg-4);
  font-variant-numeric: tabular-nums;
}
.milestones__tick--hit { color: var(--sw-success); }

/* board */

.board-wrap { position: relative; }
.board {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--sw-bg);
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-md);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
  perspective: 700px;
}
.cell-hole {
  position: absolute; width: 16.6667%; height: 16.6667%;
  background: var(--sw-bg-subtle);
}
.tile {
  position: absolute; width: 16.6667%; height: 16.6667%;
  transition: transform 160ms var(--sw-ease), opacity 160ms var(--sw-ease);
  will-change: transform;
  transform-style: preserve-3d;
}
.tile__inner {
  width: 90%; height: 90%; margin: 5%;
  border-radius: var(--sw-radius-md);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  transition: box-shadow var(--sw-dur) var(--sw-ease), transform var(--sw-dur) var(--sw-ease);
  /* pseudo-3D: beveled/glossy tile — inset highlight + inset shadow + drop shadow */
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.5),
    inset 0 -3px 5px rgba(0, 0, 0, 0.2),
    0 2px 3px rgba(0, 0, 0, 0.16);
}
.tile__inner::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, 0.08) 100%);
  pointer-events: none;
}
.tile__inner svg { width: 54%; height: 54%; display: block; position: relative; z-index: 1; }
.tile--selected .tile__inner {
  transform: translateZ(6px) rotateX(6deg);
  box-shadow: 0 0 0 2px var(--sw-primary), var(--sw-shadow-glow), 0 6px 10px rgba(0, 0, 0, 0.22);
}
.tile--pop { animation: tile-pop 190ms var(--sw-ease) forwards; }
@keyframes tile-pop {
  40% { transform: scale(1.14) rotateX(10deg) rotateY(-10deg); opacity: 1; }
  100% { transform: scale(0.4) rotateX(60deg); opacity: 0; }
}
.tile--spawn { animation: tile-spawn 200ms var(--sw-ease); }
@keyframes tile-spawn {
  from { transform: translateY(-60%) scale(0.9) rotateX(-30deg); opacity: 0; }
}

/* specials */
.tile--FH .tile__inner::after, .tile--FV .tile__inner::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.55) 0 3px, transparent 3px 9px);
}
.tile--FH .tile__inner::after {
  background: repeating-linear-gradient(90deg, rgba(255,255,255,0.55) 0 3px, transparent 3px 9px);
}
.tile--G .tile__inner::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background:
    linear-gradient(0deg, transparent 44%, rgba(255,255,255,0.75) 44% 56%, transparent 56%),
    linear-gradient(90deg, transparent 44%, rgba(255,255,255,0.75) 44% 56%, transparent 56%);
}
.tile--B .tile__inner {
  background: var(--sw-selection-gold) !important;
  color: #fff !important;
  box-shadow: 0 0 10px rgba(186, 150, 98, 0.55);
}

/* blockers */
.tile--tag .tile__inner { outline: 2px dashed var(--sw-fg-4); outline-offset: -2px; opacity: 0.9; }
.tile__badge {
  position: absolute; top: -4px; right: -4px; width: 45%; height: 45%;
  background: var(--sw-bg); border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-pill);
  display: flex; align-items: center; justify-content: center;
  color: var(--sw-fg-3);
  box-shadow: var(--sw-shadow-btn);
}
.tile__badge svg { width: 62%; height: 62%; }
.tile--lock .tile__inner { filter: grayscale(0.75); opacity: 0.85; }
.tile--tape .tile__inner {
  background: repeating-linear-gradient(-45deg, var(--sw-warning) 0 8px, var(--sw-footer-blue) 8px 16px);
  border-radius: var(--sw-radius-sm);
}
.tile--tape .tile__hp {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: var(--sw-fs-sm); font-weight: 900; color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

/* floating score + toasts */
.float-pts {
  position: absolute; z-index: 20; pointer-events: none;
  font-weight: 900; font-size: var(--sw-fs-lg); color: var(--sw-primary);
  transform: translate(-50%, -50%);
  animation: float-pts 650ms var(--sw-ease) forwards;
  font-variant-numeric: tabular-nums;
}
@keyframes float-pts {
  to { transform: translate(-50%, -170%); opacity: 0; }
}
.toast {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%);
  background: var(--sw-footer-blue); color: #fff;
  font-size: var(--sw-fs-sm); font-weight: 700;
  border-radius: var(--sw-radius-md); padding: 10px 20px;
  box-shadow: var(--sw-shadow-card);
  z-index: 60; opacity: 0;
  animation: toast-in 2.2s var(--sw-ease) forwards;
  white-space: nowrap;
}
@keyframes toast-in {
  8% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; }
}

.play-actions { display: flex; justify-content: center; margin-top: var(--sw-space-4); }

/* ---------------------------------------------------------------- leaderboard */

.tabs { display: flex; gap: var(--sw-space-2); margin-bottom: var(--sw-space-4); }
.tab {
  font-family: var(--sw-font-sans); font-size: var(--sw-fs-sm); font-weight: 700;
  border: 1px solid var(--sw-border); background: var(--sw-bg); color: var(--sw-fg-3);
  border-radius: var(--sw-radius-pill); padding: 8px 20px; cursor: pointer;
  transition: all var(--sw-dur) var(--sw-ease);
}
.tab--active { background: var(--sw-primary); border-color: var(--sw-primary); color: #fff; }

.lb { background: var(--sw-bg); border: 1px solid var(--sw-border); border-radius: var(--sw-radius-md); overflow: hidden; }
.lb__row {
  display: flex; align-items: center; gap: var(--sw-space-3);
  padding: 10px var(--sw-space-4);
  border-bottom: 1px solid var(--sw-border-weak);
  font-size: var(--sw-fs-sm); font-weight: 500;
}
.lb__row:last-child { border-bottom: none; }
.lb__row--head {
  font-size: var(--sw-fs-2xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--sw-fg-3); background: var(--sw-bg-subtle);
}
.lb__row--me { background: var(--sw-main-light); font-weight: 700; position: sticky; bottom: 0; box-shadow: 0 -1px 0 var(--sw-border); }
.lb__row--draw-edge { border-bottom: 2px solid var(--sw-selection-gold); }
.lb__rank { width: 44px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lb__rank--draw { color: var(--sw-selection-gold); }
.lb__pseudo { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb__score { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- modals */

.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 22, 51, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sw-space-4);
}
.modal {
  background: var(--sw-bg); border-radius: var(--sw-radius-lg);
  padding: var(--sw-space-6);
  width: 100%; max-width: 420px;
  box-shadow: var(--sw-shadow-card);
  animation: modal-in 200ms var(--sw-ease);
}
@keyframes modal-in { from { transform: translateY(12px); opacity: 0; } }
.modal h3 { margin-bottom: var(--sw-space-3); }
.modal p { color: var(--sw-fg-3); margin-bottom: var(--sw-space-4); }
.modal .rules-list { margin: 0 0 var(--sw-space-4); padding-left: 20px; color: var(--sw-fg-3); font-size: var(--sw-fs-sm); line-height: 1.55; }
.modal__actions { display: flex; gap: var(--sw-space-3); justify-content: flex-end; margin-top: var(--sw-space-4); }
.modal__error { color: var(--sw-danger); font-size: var(--sw-fs-xs); font-weight: 700; min-height: 18px; margin-top: 6px; }
.modal__score { font-size: var(--sw-fs-display); line-height: 1.1; font-weight: 900; color: var(--sw-primary); font-variant-numeric: tabular-nums; }

@media (min-width: 640px) {
  .view { padding: var(--sw-space-6); }
  .board-wrap { max-width: 480px; margin: 0 auto; }
  .playbar, .milestones { max-width: 480px; margin-left: auto; margin-right: auto; }
  .milestones { margin-bottom: var(--sw-space-4); }
}
