/* Charleston Trainer — every color comes from the shell's --g-* variables,
   so the table survives any background and theme combination. */

.ch-wrap{
  width:100%; max-width:860px; margin:0 auto;
  display:flex; flex-direction:column; align-items:center; gap:14px;
}

.ch-hud{
  display:flex; flex-wrap:wrap; align-items:center; justify-content:center; gap:8px 14px;
  font-size:13px; color:var(--g-muted);
}
.ch-hud b{ color:var(--g-heading); font-weight:600; }
.ch-lv{
  font-family:var(--serif,'Cormorant Garamond',Georgia,serif);
  font-size:19px; font-weight:600; color:var(--g-heading);
}

/* the line you are building */
.ch-line{
  width:100%; padding:12px 14px; border-radius:var(--g-radius);
  background:var(--g-panel); border:1px solid var(--g-line); text-align:center;
}
.ch-line h2{
  margin:0 0 8px; font-size:13px; font-weight:600; letter-spacing:.08em;
  text-transform:uppercase; color:var(--g-muted);
}
.ch-groups{ display:flex; flex-wrap:wrap; gap:10px 14px; justify-content:center; }
.ch-group{ display:flex; flex-direction:column; align-items:center; gap:4px; }
.ch-group .lab{ font-size:10px; letter-spacing:.06em; text-transform:uppercase; color:var(--g-muted); }
.ch-group .row{ display:flex; gap:3px; }
.ch-group .row .tl{ transform:scale(.62); transform-origin:top center; }
.ch-group .row{ min-height:56px; align-items:flex-start; }

/* rack */
.ch-rack{
  display:flex; flex-wrap:wrap; gap:7px; justify-content:center;
  padding:14px 12px; border-radius:var(--g-radius);
  background:var(--g-card); border:1px solid var(--g-line); box-shadow:var(--g-shadow-md);
}
/* no level running: the empty rack collapses to a stray white pill on the
   level-select screen, so hide it until tiles are dealt */
.ch-rack:empty{ display:none; }
.ch-tile{
  padding:0; border:1px solid var(--g-line); border-radius:11px; cursor:pointer;
  background:linear-gradient(180deg, var(--g-panel), var(--g-card));
  box-shadow:var(--g-shadow-sm);
  transition:transform .1s, box-shadow .15s, border-color .15s;
  display:flex; align-items:center; justify-content:center;
}
.ch-tile .tl{ transform:scale(.86); }
.ch-tile:hover{ transform:translateY(-3px); box-shadow:var(--g-shadow-lg); }
.ch-tile.sel{
  border-color:var(--g-accent); transform:translateY(-6px);
  box-shadow:0 0 0 3px var(--g-accent-soft), var(--g-shadow-md);
}
.ch-tile.keep{ border-color:var(--g-accent); }
.ch-tile.hint{ border-color:var(--g-accent-dk); animation:ch-pulse 1.1s ease infinite; }
@keyframes ch-pulse{ 0%,100%{ box-shadow:var(--g-shadow-sm); } 50%{ box-shadow:0 0 0 4px var(--g-accent-soft); } }
.ch-tile.gone{ opacity:.28; cursor:default; }

.ch-ctrl{ display:flex; gap:9px; justify-content:center; flex-wrap:wrap; }
.ch-feed{ margin:0; min-height:22px; font-size:14px; color:var(--g-muted); text-align:center; max-width:620px; }
.ch-feed.warn{ color:var(--g-heading); font-weight:600; }
.ch-feed.ok{ color:var(--g-accent-dk); font-weight:600; }

/* result (fixed overlay — never pushes the board down) */
.ch-result{ position:fixed; inset:0; z-index:90; display:flex; align-items:center; justify-content:center;
  padding:18px; background:rgba(10,14,18,.52); backdrop-filter:blur(3px); }
.ch-result[hidden]{ display:none; }
.ch-result-card{ width:min(440px,92vw); max-height:90vh; overflow:auto; text-align:center; padding:20px 16px; border-radius:var(--g-radius);
  background:linear-gradient(180deg, var(--g-card), var(--g-bg));
  border:1px solid var(--g-accent-edge); box-shadow:0 0 0 4px var(--g-accent-soft), var(--g-shadow-lg), inset 0 1px 0 rgba(255,255,255,.28); }
.ch-result h2{
  margin:0 0 8px; font-family:var(--serif,'Cormorant Garamond',Georgia,serif);
  font-size:25px; color:var(--g-heading);
}
.ch-stars{ font-size:26px; letter-spacing:6px; color:var(--g-accent); margin-bottom:6px; }
.ch-line{ margin:0 0 14px; font-size:15px; color:var(--g-muted); }
.ch-line b{ color:var(--g-heading); }

/* level picker */
.ch-levels{ width:100%; text-align:center; }
.ch-levels h2{
  margin:0 0 6px; font-family:var(--serif,'Cormorant Garamond',Georgia,serif);
  font-size:21px; color:var(--g-heading);
}
.ch-levels-tip{
  margin:0 auto 14px; max-width:58ch; font-size:13px; line-height:1.5;
  color:var(--g-muted);
}
.ch-cards{ display:grid; gap:10px; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); }
.ch-card{
  text-align:left; padding:12px 13px; border-radius:14px; cursor:pointer;
  background:linear-gradient(180deg, var(--g-panel), var(--g-card));
  border:1px solid var(--g-line); box-shadow:var(--g-shadow-sm);
  transition:transform .1s, box-shadow .15s, border-color .15s;
}
.ch-card:hover{ transform:translateY(-2px); box-shadow:var(--g-shadow-md); border-color:var(--g-accent); }
.ch-card h3{ margin:0 0 3px; font-size:15px; font-weight:600; color:var(--g-heading); }
.ch-card p{ margin:0; font-size:12px; color:var(--g-muted); line-height:1.45; }
.ch-card .st{ display:block; margin-top:6px; font-size:13px; color:var(--g-accent); letter-spacing:2px; }
.ch-card .best{ display:block; margin-top:4px; font-size:11px; color:var(--g-muted); }
.ch-card.locked{ opacity:.5; cursor:not-allowed; }
.ch-card.locked:hover{ transform:none; box-shadow:var(--g-shadow-sm); border-color:var(--g-line); }

/* Help overlay for the top-right "?" button (same pattern as Tile IQ). */
.ch-help{ position:fixed; inset:0; z-index:92; display:flex; align-items:center; justify-content:center;
  padding:18px; background:rgba(10,14,18,.52); backdrop-filter:blur(3px);
  opacity:0; transition:opacity .18s ease; }
.ch-help.show{ opacity:1; }

.ch-help-card{ position:relative; width:min(560px,94vw); max-height:86vh; overflow:auto;
  padding:26px 26px 28px; border-radius:16px;
  background:linear-gradient(180deg, var(--g-card), var(--g-bg));
  border:1px solid var(--g-accent-edge);
  box-shadow:0 0 0 4px var(--g-accent-soft), var(--g-shadow-lg), inset 0 1px 0 rgba(255,255,255,.28);
  transform:translateY(8px); transition:transform .18s ease; }
.ch-help.show .ch-help-card{ transform:translateY(0); }
.ch-help-card h2{ font-family:var(--serif,'Cormorant Garamond',Georgia,serif); font-size:24px;
  color:var(--g-heading); margin:0 0 12px; }
.ch-help-card h3{ font-family:var(--serif,'Cormorant Garamond',Georgia,serif); font-size:16px;
  color:var(--g-heading); margin:18px 0 6px; }
.ch-help-lead{ max-width:62ch; font-size:14px; line-height:1.66; color:var(--g-fg); margin:0 0 4px; }
.ch-help-card p{ max-width:64ch; font-size:13.5px; line-height:1.72; color:var(--g-muted); margin:8px 0 0; }
.ch-help-note{ border-top:1px solid var(--g-line); padding-top:10px; margin-top:16px !important;
  font-size:12px; opacity:.85; }
.ch-help-x{ position:absolute; top:12px; right:12px; width:34px; height:34px; flex:0 0 auto;
  display:inline-flex; align-items:center; justify-content:center; cursor:pointer; font:inherit;
  font-size:22px; line-height:1; color:var(--g-strong);
  background:linear-gradient(180deg, var(--g-card), var(--g-bg));
  border:1px solid var(--g-line); border-radius:50%;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.18), var(--g-shadow-sm);
  transition:border-color .15s, color .15s, transform .12s; }
.ch-help-x:hover{ border-color:var(--g-accent); color:var(--g-accent); transform:translateY(-1px); }
.ch-help-x:focus-visible{ outline:2px solid var(--g-accent); outline-offset:2px; }

@media (max-width:560px){
  .ch-tile .tl{ transform:scale(.72); }
  .ch-group .row .tl{ transform:scale(.52); }
  .ch-help-card{ padding:22px 18px 24px; }
}

/* Trademark / non-affiliation notice for this game-shell page. Sits below the
   full-height game area so it never crowds the play field, and adapts to the
   shell day/night theme through the shared --g-line / --g-muted variables. */
.game-foot{ position:fixed; left:0; right:0; bottom:0; z-index:50;
  padding:7px 16px 8px; background:rgba(18,18,20,.86);
  border-top:1px solid rgba(255,255,255,.14);
  text-align:center; font-size:11px; line-height:1.5; color:#efe9dc; }
.game-foot .flegal-note{ display:block; max-width:74ch; margin:0 auto; }
.mj-stage{ padding-bottom:46px; }

/* Night variant for the paper + brass combo: warm dark, brass accent kept.
   This page starts in the light/day state (data-night="1"); toggling the
   day-night control removes it and this block takes over, so the theme color
   actually changes. Scoped here so it touches only this training page. */
.mj-game[data-bg="paper"]:not([data-night="1"]){
  --g-bg:#1B1712; --g-bg2:#120F0B; --g-card:#2A2319;
  --g-fg:#F1E9DC; --g-muted:#B9A98F; --g-strong:#E8C99A;
  --g-line:rgba(212,180,131,.20);
  --g-glass:rgba(18,15,11,.82); --g-panel:#2A2319;
  --g-glow1:rgba(176,141,87,.14); --g-glow2:rgba(60,40,20,.10);
  --g-shadow-sm:0 1px 2px rgba(0,0,0,.40), 0 2px 6px rgba(0,0,0,.35);
  --g-shadow-md:0 6px 16px rgba(0,0,0,.45), 0 16px 38px rgba(0,0,0,.50);
  --g-shadow-lg:0 14px 32px rgba(0,0,0,.55), 0 34px 70px rgba(0,0,0,.60);
  --g-heading:var(--g-accent-lt);
}
