/* =========================================================
   Rohan's Arena — dashboard.css
   Light "paper + ink" system · electric indigo accent
   ========================================================= */

/* ---------- tokens ---------- */
:root {
  --paper: #f4f1e9;
  --paper-2: #faf8f2;
  --card: #ffffff;
  --ink: #15141a;
  --ink-soft: #5f5a52;
  --ink-faint: #8d877c;
  --line: #e4ded1;
  --line-soft: #efeae0;

  --accent: #3b2ff5;
  --accent-ink: #2a1fbf;
  --lime: #d9f95f;
  --coral: #ff6b4a;

  --r-lg: 24px;
  --r-md: 18px;
  --r-sm: 12px;

  --shadow-sm: 0 1px 2px rgba(21, 20, 26, .04), 0 8px 24px -18px rgba(21, 20, 26, .35);
  --shadow-md: 0 2px 4px rgba(21, 20, 26, .04), 0 18px 40px -24px rgba(21, 20, 26, .45);

  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "SF Mono", ui-monospace, "Consolas", monospace;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

::selection { background: var(--lime); color: #101014; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* very subtle paper grain */
.grain {
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: .32;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='160' height='160' filter='url(%23n)' opacity='.16'/></svg>");
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 26px;
  height: 66px;
  padding: 0 clamp(16px, 4vw, 40px);
  background: rgba(244, 241, 233, .82);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: -.01em;
  font-size: 15px;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--lime);
  box-shadow: 0 6px 16px -10px rgba(21, 20, 26, .9);
}

.brand-name em {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
}

.nav {
  display: flex;
  gap: 4px;
  margin-left: 6px;
}

.nav-link {
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color .15s ease, background .15s ease;
}

.nav-link:hover { color: var(--ink); background: rgba(21, 20, 26, .045); }

.nav-link.is-active {
  color: var(--ink);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.chip-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
}

.chip-live .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38b26a;
  box-shadow: 0 0 0 3px rgba(56, 178, 106, .16);
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(160deg, #2b2a33, #15141a);
  color: #f7f5ef;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--line);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 550;
  letter-spacing: -.005em;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
  white-space: nowrap;
}

.btn-sm { height: 34px; padding: 0 13px; font-size: 13px; }

.btn-primary {
  background: var(--ink);
  color: #fbfaf6;
  box-shadow: 0 10px 22px -14px rgba(21, 20, 26, .9);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 16px 28px -16px rgba(21, 20, 26, .85); }
.btn-primary:active { transform: translateY(0); }

.btn-quiet {
  background: var(--card);
  border-color: var(--line);
  color: var(--ink);
}

.btn-quiet:hover { border-color: #d3ccbc; background: var(--paper-2); }

/* ---------- layout ---------- */
.shell { min-height: 100vh; }

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(26px, 4vw, 46px) clamp(16px, 4vw, 40px) 72px;
}

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr);
  gap: 22px;
  align-items: stretch;
}

.eyebrow {
  margin: 0 0 18px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.eyebrow .sep { margin: 0 8px; opacity: .5; }

.display {
  margin: 0;
  font-size: clamp(38px, 5.4vw, 62px);
  line-height: .98;
  letter-spacing: -.042em;
  font-weight: 700;
  color: var(--ink);
}

.mark {
  position: relative;
  display: inline-block;
  padding: 0 2px;
}

.mark::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: .07em;
  height: .3em;
  background: var(--lime);
  z-index: -1;
  border-radius: 2px;
  transform: skewX(-8deg);
}

.lede {
  margin: 18px 0 0;
  max-width: 44ch;
  font-size: 15.5px;
  color: var(--ink-soft);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

/* ---------- level card ---------- */
.level-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  border-radius: var(--r-lg);
  background: radial-gradient(120% 90% at 100% 0%, #26252f 0%, #16151c 46%, #111015 100%);
  color: #f4f2ea;
  box-shadow: var(--shadow-md);
}

.level-card::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -90px;
  top: -110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 249, 95, .28), transparent 68%);
  filter: blur(8px);
  pointer-events: none;
}

.level-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.level-label {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(244, 242, 234, .55);
}

.level-rank {
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid rgba(217, 249, 95, .35);
  background: rgba(217, 249, 95, .1);
  color: var(--lime);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
}

.level-ring {
  position: relative;
  display: grid;
  place-items: center;
  margin: 2px auto 0;
  z-index: 1;
}

.level-ring svg { transform: rotate(-90deg); }

.ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, .1);
  stroke-width: 8;
}

.ring-fill {
  fill: none;
  stroke: var(--lime);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: calc(327 - (327 * var(--pct, 0) / 100));
  filter: drop-shadow(0 0 10px rgba(217, 249, 95, .4));
}

.level-ring-text {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.level-ring-text strong {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.04em;
}

.level-ring-text span {
  margin-top: 5px;
  font-size: 10px;
  letter-spacing: .2em;
  color: rgba(244, 242, 234, .5);
}

.level-hint {
  margin: 0;
  text-align: center;
  font-size: 12.5px;
  color: rgba(244, 242, 234, .6);
  position: relative;
  z-index: 1;
}

.level-hint b { color: #fff; font-weight: 600; }

.level-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .1);
  position: relative;
  z-index: 1;
}

.level-foot .k {
  display: block;
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(244, 242, 234, .45);
}

.level-foot .v {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 17px;
  letter-spacing: -.02em;
}

/* ---------- stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: border-color .16s ease, transform .16s ease;
}

.stat:hover { border-color: #d6cfbf; transform: translateY(-2px); }

.stat-label {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.stat-value {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -.035em;
  line-height: 1.25;
}

.stat-value small {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--ink-faint);
}

.stat-note { font-size: 12px; color: var(--ink-soft); }

/* ---------- section header ---------- */
.block { margin-top: 46px; }

.block-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.block-title {
  margin: 0;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -.03em;
}

.block-sub {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.count-chip {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* ---------- games ---------- */
.games {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.game {
  position: relative;
  border-radius: var(--r-md);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

/* feature */
.game-feature {
  grid-column: span 2;
  grid-row: span 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  min-height: 316px;
  padding: 26px;
  color: #f6f4ee;
  background: linear-gradient(158deg, #1e1d26 0%, #141319 58%, #100f14 100%);
  box-shadow: var(--shadow-md);
}

.game-feature::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(90% 70% at 100% 0%, rgba(217, 249, 95, .16), transparent 62%);
  pointer-events: none;
}

.game-feature:hover { transform: translateY(-3px); box-shadow: 0 26px 50px -26px rgba(21, 20, 26, .75); }

.game-tag {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--lime);
  color: #111014;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.game-feature::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(65% 60% at 88% 18%, #000 0%, transparent 72%);
  mask-image: radial-gradient(65% 60% at 88% 18%, #000 0%, transparent 72%);
  opacity: .55;
  pointer-events: none;
}

.game-art {
  position: absolute;
  right: -26px;
  top: 54px;
  width: 210px;
  height: 210px;
  transform: rotate(-13deg);
  opacity: .78;
  pointer-events: none;
}

.game-art .blk {
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 10px;
}

.b1 { left: 0; top: 0; background: var(--lime); opacity: .9; }
.b2 { left: 58px; top: 0; background: #fff; opacity: .22; }
.b3 { left: 58px; top: 58px; background: var(--coral); opacity: .85; }
.b4 { left: 0; top: 58px; background: #fff; opacity: .14; }

.game-body { position: relative; z-index: 1; }

.game-feature h3 {
  margin: 0;
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -.035em;
}

.game-feature p {
  margin: 8px 0 18px;
  max-width: 34ch;
  font-size: 13.5px;
  color: rgba(246, 244, 238, .62);
}

.game-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--lime);
}

.game-cta svg { transition: transform .18s ease; }
.game-feature:hover .game-cta svg { transform: translateX(4px); }

/* tiles */
.game-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 17px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.game-tile:hover { transform: translateY(-3px); border-color: #d6cfbf; box-shadow: var(--shadow-md); }

.tile-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: 8px;
  border-radius: 11px;
}

.tint-snake { background: #eaf6e2; color: #3a7a2b; }
.tint-2048 { background: #fdf1d8; color: #a2650f; }
.tint-memory { background: #edeaff; color: #5443d1; }
.tint-chess { background: #e7eef8; color: #2c4c78; }

.game-tile h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.015em;
}

.game-tile p {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.tile-arrow {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 14px;
  color: var(--ink-faint);
  transition: transform .18s ease, color .18s ease;
}

.game-tile:hover .tile-arrow { transform: translate(2px, -2px); color: var(--ink); }

/* add card */
.game-add {
  grid-column: span 4;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1.5px dashed #d8d1c2;
  background: rgba(255, 255, 255, .45);
}

.game-add h3 { margin: 0; font-size: 14px; font-weight: 600; }
.game-add p { margin: 0; font-size: 12.5px; color: var(--ink-faint); }

.game-add > div { flex: 1; }

.add-go {
  margin-left: auto;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-faint);
  white-space: nowrap;
}

.add-plus {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 11px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  font-size: 18px;
  color: var(--ink-soft);
}

/* ---------- vault ---------- */
.vault {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 30px 20px;
  border: 1.5px dashed #d8d1c2;
  border-radius: var(--r-md);
  background: var(--paper-2);
  text-align: center;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--accent);
  background: #f6f4ff;
}

.dropzone.drag-over { transform: scale(1.005); }

.dz-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 6px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.dz-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 550;
}

.dz-title span { color: var(--ink-faint); font-weight: 400; }

.dz-hint { margin: 0; font-size: 12.5px; color: var(--ink-faint); }

.dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* upload progress */
.upload-progress {
  display: none;
  margin-top: 14px;
  padding: 0 4px;
}

.upload-progress.active { display: block; }

.upload-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
}

.upload-bar-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #7f74ff);
  transition: width .2s ease;
}

.upload-status {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--ink-soft);
}

/* file list */
.file-list { margin-top: 6px; }

.file-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 10px;
  transition: background .14s ease;
}

.file-row:hover { background: var(--paper-2); }
.file-row:last-child { border-bottom: none; }

.file-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  font-size: 18px;
  line-height: 1;
}

.file-meta { min-width: 0; }

.file-name {
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-sub {
  font-size: 11.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color .14s ease, border-color .14s ease, background .14s ease;
}

.file-btn:hover { color: var(--ink); border-color: #d3ccbc; background: var(--paper-2); }

.file-btn.danger { color: #b23a28; }
.file-btn.danger:hover { border-color: #f0c4ba; background: #fdf3f0; color: #982414; }

.file-btn.confirming {
  background: #b23a28;
  border-color: #b23a28;
  color: #fff;
}

.file-empty {
  margin: 0;
  padding: 26px 8px 18px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-faint);
}

/* ---------- footer ---------- */
.foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 44px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-faint);
}

.foot-dot { opacity: .6; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 50;
  transform: translate(-50%, 12px);
  padding: 11px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: #f8f6f0;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .6);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- entrance motion ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-copy, .level-card, .stat, .game, .vault {
  animation: rise .5s cubic-bezier(.22, .8, .28, 1) both;
}

.level-card { animation-delay: .05s; }
.stat:nth-child(1) { animation-delay: .08s; }
.stat:nth-child(2) { animation-delay: .12s; }
.stat:nth-child(3) { animation-delay: .16s; }
.stat:nth-child(4) { animation-delay: .2s; }
.game:nth-child(1) { animation-delay: .1s; }
.game:nth-child(2) { animation-delay: .14s; }
.game:nth-child(3) { animation-delay: .18s; }
.game:nth-child(4) { animation-delay: .22s; }
.game:nth-child(5) { animation-delay: .26s; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; }
  .level-card { min-height: 260px; }
  .level-foot { margin-top: 4px; }
}

@media (max-width: 900px) {
  .games { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-feature { grid-column: span 2; grid-row: auto; min-height: 280px; }
  .game-add { grid-column: span 2; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav { display: none; }
}

@media (max-width: 620px) {
  .topbar { gap: 12px; height: 60px; }
  .chip-live { display: none; }
  .display { font-size: clamp(34px, 11vw, 44px); }
  .games { grid-template-columns: 1fr; }
  .game-feature, .game-add { grid-column: span 1; }
  .game-feature { min-height: 260px; }
  .block-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .file-row { grid-template-columns: 36px minmax(0, 1fr); }
  .file-actions { grid-column: span 2; justify-content: flex-start; padding-top: 2px; }
  .file-name { white-space: normal; }
}

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