/* Mahjong trainer — large type, high contrast, phone/iPad-first.
   Chrome wears the Tamarisk CC brand (matching the poker trainer); the
   navy/green/red on tiles and hand lines are NMJL-card semantics and are
   deliberately NOT branded. */
:root {
  --navy: #1d2d5c;
  --green: #1e7d46;
  --red: #b03030;
  --ink: #222;
  --paper: #faf7f0;
  --tile-face: #fffdf6;
  --accent: #17603f;
  --ok: #1e7d46;
  --warn: #b03030;
  /* Tamarisk CC brand, sampled from the club monogram (same values as the
     poker trainer). Clay is only ~3:1 on white — large text and chrome only. */
  --tcc-brown: #403830;
  --tcc-clay: #e0785f;
  --dim: #55606b;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}
main { max-width: 900px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.6rem; color: var(--tcc-brown); margin: .4em 0; }
h2 { font-size: 1.25rem; color: var(--tcc-brown); margin: 1em 0 .4em; }
a { color: var(--accent); }

header.site {
  background: var(--tcc-brown); color: #fff; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  border-bottom: 4px solid var(--tcc-clay);
}
header.site .brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
header.site .mark { width: 44px; height: 44px; border-radius: 9px; display: block; flex: none; }
header.site .brandtext { display: flex; flex-direction: column; line-height: 1.12; }
header.site .club {
  font-size: 12px; font-weight: 800; letter-spacing: 1.6px;
  text-transform: uppercase; color: var(--tcc-clay);
}
header.site .game { font-size: 20px; font-weight: 800; }
header.site nav a { color: rgba(255,255,255,.75); text-decoration: none; margin-left: 14px; font-size: 1rem; }
header.site nav a.here { color: #fff; font-weight: 600; border-bottom: 2px solid var(--tcc-clay); }
@media (max-width: 480px) {
  header.site .mark { width: 36px; height: 36px; }
  header.site .game { font-size: 17px; }
  header.site nav a { margin-left: 0; margin-right: 12px; }
}

footer.site {
  border-top: 3px solid var(--tcc-clay); margin-top: 50px; padding: 22px 16px 10px;
  color: var(--dim); font-size: 16px; max-width: 900px; margin-left: auto; margin-right: auto;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
footer.site .mark { width: 38px; height: 38px; border-radius: 8px; flex: none; }
footer.site .who { font-weight: 800; color: var(--tcc-brown); display: block; font-size: 17px; }
footer.site .said { flex: 1 1 260px; }

button, .btn {
  font: inherit; font-weight: 600;
  background: var(--accent); color: #fff;
  border: 0; border-radius: 10px;
  padding: 12px 22px; cursor: pointer;
}
button.secondary { background: #e8e4d8; color: var(--tcc-brown); }
select { font: inherit; padding: 8px 10px; border-radius: 8px; max-width: 100%; border: 2px solid #c9c2b2; background: #fff; }
button:disabled { opacity: .4; cursor: default; }

/* ---------------- tiles ---------------- */
.rack { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.tile {
  width: 54px; height: 74px;
  background: var(--tile-face);
  border: 2px solid #c9c2b2;
  border-bottom-width: 5px;
  border-radius: 8px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-weight: 800; cursor: pointer; user-select: none;
  -webkit-user-select: none;
  position: relative;
}
.tile .big { font-size: 26px; line-height: 1; }
.tile .sub { font-size: 11px; letter-spacing: .5px; margin-top: 4px; font-weight: 700; }
.tile.crak .big, .tile.crak .sub { color: var(--red); }
.tile.bam .big, .tile.bam .sub { color: var(--green); }
.tile.dot .big, .tile.dot .sub { color: var(--navy); }
.tile.wind .big, .tile.wind .sub { color: var(--navy); }
.tile.dragonR .big, .tile.dragonR .sub { color: var(--red); }
.tile.dragonG .big, .tile.dragonG .sub { color: var(--green); }
.tile.dragon0 .big { color: var(--navy); }
.tile.dragon0 .big { border: 2px solid var(--navy); border-radius: 4px; padding: 0 6px; }
.tile.dragon0 .sub { color: var(--navy); }
.tile.flower .big { color: #8a5fb0; }
.tile.flower .sub { color: #8a5fb0; }
.tile.joker .big { color: #b06f10; }
.tile.joker .sub { color: #b06f10; }
.tile.selected { outline: 4px solid #e0a020; outline-offset: -2px; transform: translateY(-6px); }
.rack.arrange .tile { touch-action: none; -webkit-touch-callout: none; }
.tile.dragging { opacity: .85; box-shadow: 0 8px 18px rgba(0,0,0,.3); z-index: 10; }
.tile.incoming { box-shadow: 0 0 0 3px var(--green); }
.tile.static { cursor: default; }
.tile.small { width: 40px; height: 56px; }
.tile.small .big { font-size: 19px; }
.tile.small .sub { font-size: 9px; }

/* ---------------- card-hand lines ---------------- */
.handline { font-weight: 800; font-size: 1.05rem; letter-spacing: .04em; white-space: normal; }
.handline .g { color: var(--green); }
.handline .r { color: var(--red); }
.handline .n { color: var(--navy); }
.handline .k { color: var(--ink); font-weight: 400; font-size: .85em; letter-spacing: 0; }
.handline .or { color: #777; font-weight: 400; font-size: .8em; padding: 0 4px; }

.handrow {
  display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  border: 2px solid transparent;
}
.pickcomment { flex-basis: 100%; font-size: .92rem; padding-top: 2px; color: #444; }
.pickcomment.good { color: var(--ok); }
.pickcomment.ok { color: #6b7a1e; }
.pickcomment.warn { color: #a06a00; }
.pickcomment.bad { color: var(--warn); }
.rankbadge {
  display: inline-block; min-width: 2.2em; text-align: center;
  font-weight: 800; border-radius: 8px; padding: 2px 6px; margin-right: 8px;
  background: #e8e4d8; color: var(--navy);
}
.rankbadge.good { background: #d9ecdc; color: var(--ok); }
.rankbadge.bad { background: #f3dcd9; color: var(--warn); }
.mode-row label { display: block; margin: 6px 0; cursor: pointer; }
.handrow:hover { background: #f1ecdf; }
.handrow.selected { border-color: #e0a020; background: #fbf3dd; }
.handrow .val { margin-left: auto; font-weight: 700; color: var(--navy); white-space: nowrap; }
.handrow .val .c { color: var(--red); }
.section-title { font-weight: 800; color: var(--navy); letter-spacing: .1em; margin: 14px 0 2px; }

/* compact card listing (card.html): tight vertical rhythm */
.handrow.compact { padding: 1px 10px; }
.handrow.compact .handline { line-height: 1.3; font-size: 1rem; }
.compact-page .section-title { margin: 10px 0 0; }

details.section > summary {
  cursor: pointer; font-weight: 800; color: var(--navy);
  letter-spacing: .08em; padding: 8px 0; font-size: 1.05rem;
}

/* ---------------- analysis table ---------------- */
.analysis { border-collapse: collapse; width: 100%; margin: 12px 0; }
.analysis th, .analysis td { text-align: left; padding: 8px 10px; vertical-align: top; }
.analysis tr { border-bottom: 1px solid #e2dccb; }
.analysis .away { font-size: 1.3rem; font-weight: 800; color: var(--navy); text-align: center; }
.analysis tr.picked { background: #fbf3dd; }
.analysis .why { font-size: .92rem; color: #444; }

.scorecard {
  display: flex; gap: 16px; margin: 14px 0; flex-wrap: wrap;
}
.scorecard .box {
  background: #fff; border: 2px solid #e2dccb; border-radius: 12px;
  padding: 12px 20px; text-align: center; min-width: 130px;
}
.scorecard .box .num { font-size: 2rem; font-weight: 800; color: var(--navy); }
.scorecard .box.good .num { color: var(--ok); }
.scorecard .box.poor .num { color: var(--warn); }

.note { background: #fdf6e3; border-left: 4px solid #e0a020; padding: 10px 14px; margin: 10px 0; border-radius: 0 8px 8px 0; }
.coach { background: #fff; border: 2px solid #e2dccb; border-radius: 12px; padding: 14px 18px; margin: 12px 0; }

.phase-banner {
  background: var(--tcc-brown); color: #fff; border-left: 5px solid var(--tcc-clay); border-radius: 10px;
  padding: 12px 18px; font-weight: 700; font-size: 1.1rem; margin: 12px 0;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
}
.phase-banner .dir { font-size: 1.3rem; }

.mode-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 20px 0; }
.mode-card {
  background: #fff; border: 2px solid #e2dccb; border-radius: 14px;
  padding: 18px; text-decoration: none; color: var(--ink);
}
.mode-card h3 { margin: 0 0 6px; color: var(--tcc-brown); }
.mode-card:hover { border-color: var(--tcc-clay); }

.lesson { max-width: 720px; }
.lesson h2 { margin-top: 1.4em; }

@media (max-width: 520px) {
  .tile { width: 44px; height: 62px; }
  .tile .big { font-size: 21px; }
  .tile .sub { font-size: 9px; }
  body { font-size: 16px; }
}
