:root {
  --ink: #2b2620;
  --ink-soft: #6d655b;
  --bg: #f6f0e4;
  --paper: #fffdf8;
  --line: #e2d8c6;
  --primary: #3d5a80;
  --primary-dark: #263c58;
  --tile: #ece3d2;
  --tile-on: #4a4038;
  --gold: #f2c14e;
  --miss: #c4553c;
  /* 段階の色（やさしい・ふつう・むずかしい・とてもむずかしい）。色だけでなく、帯には段階の名前も書く */
  --l0: #a8d672;
  --l1: #8cc3ee;
  --l2: #f5b062;
  --l3: #c3a0e2;
  --l0d: #4c7a1f;
  --l1d: #22608f;
  --l2d: #9a5410;
  --l3d: #6a3c94;
  --font: "Zen Maru Gothic", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-weight: 500; line-height: 1.7; line-break: strict; }
.hidden { display: none !important; }
.nw { white-space: nowrap; }

.g-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; max-width: 520px; margin: 0 auto; font-size: 13px; font-weight: 900; }
.g-brand { color: var(--ink-soft); text-decoration: none; }
.g-title { flex: 1; text-align: center; }
.g-head [data-mg-account] a { color: var(--primary-dark); text-decoration: none; }

main { max-width: 520px; margin: 0 auto; padding: 0 12px 24px; }
.play { position: relative; user-select: none; -webkit-user-select: none; }

.bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.box { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px; text-align: center; min-width: 0; }
.lbl { font-size: 11px; font-weight: 900; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.val { font: 700 21px/1.3 var(--font); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lives { display: flex; justify-content: center; align-items: center; gap: 6px; height: 27px; }
.lives i { width: 14px; height: 14px; border-radius: 50%; background: var(--primary); display: block; transition: transform .3s, opacity .3s; }
.lives i.lost { background: transparent; box-shadow: inset 0 0 0 2px #cbbfab; }
.lives .left { margin-left: 4px; font-size: 15px; font-weight: 900; }
.lives i.drop { animation: drop .5s ease-out; }
@keyframes drop { 0% { transform: scale(1.6); background: var(--miss); } 100% { transform: scale(1); } }

/* 当てたなかま（色の帯） */
.found { display: flex; flex-direction: column; gap: 6px; }
.found:not(:empty) { margin-bottom: 6px; }
.band { border-radius: 12px; padding: 6px 10px 7px; text-align: center; color: #1f1b16; animation: band .45s cubic-bezier(.2, 1.4, .4, 1); }
.band .b-name { font-size: 14px; font-weight: 900; line-height: 1.35; }
.band .b-name > span:last-child { display: block; }
.band .b-lv { display: inline-block; font-size: 10px; font-weight: 900; padding: 0 6px; border-radius: 999px; background: rgba(255, 255, 255, .65); }
.band .b-words { font-size: 13px; font-weight: 700; line-height: 1.4; }
.band.l0 { background: var(--l0); } .band.l1 { background: var(--l1); } .band.l2 { background: var(--l2); } .band.l3 { background: var(--l3); }
.band.l0 .b-lv { color: var(--l0d); } .band.l1 .b-lv { color: var(--l1d); } .band.l2 .b-lv { color: var(--l2d); } .band.l3 .b-lv { color: var(--l3d); }
.band.reveal { opacity: .82; }
@keyframes band { 0% { transform: scale(.85); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* 言葉のカード 4×4 */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; touch-action: manipulation; }
.tile { position: relative; min-width: 0; height: 64px; padding: 0 3px; border: 0; border-radius: 12px; background: var(--tile); color: var(--ink); font: 900 17px/1.15 var(--font); cursor: pointer; display: grid; place-items: center; white-space: nowrap; overflow: hidden; transition: background .12s, color .12s, transform .12s; box-shadow: 0 2px 0 #d6cab4; }
.tile[data-n="5"] { font-size: 15px; }
.tile[data-n="6"] { font-size: 13px; letter-spacing: -0.02em; }
.tile:active { transform: scale(.96); }
.tile.on { background: var(--tile-on); color: #fff; box-shadow: 0 2px 0 #2a241f; }
.tile.shake { animation: shake .42s; }
.tile.pop { animation: pop .38s ease-out; }
.tile.ghost { visibility: hidden; }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes pop { 0% { transform: translateY(0) scale(1); } 45% { transform: translateY(-8px) scale(1.08); } 100% { transform: translateY(0) scale(1); } }
.grid.done .tile { cursor: default; }

.msg { margin: 8px 0 0; min-height: 1.7em; font-size: 13px; font-weight: 700; color: var(--ink-soft); text-align: center; }
.acts { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 6px; margin-top: 6px; }
.act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; padding: 6px 2px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); font: 900 13px/1.2 var(--font); cursor: pointer; white-space: nowrap; }
.act:disabled { opacity: .38; cursor: default; }
.act.go { background: var(--primary); border-color: var(--primary); color: #fff; font-size: 16px; box-shadow: 0 4px 0 var(--primary-dark); }
.act.go:disabled { box-shadow: none; }
.act.go.ready { animation: ready 1.2s ease-in-out infinite; }
@keyframes ready { 50% { transform: translateY(-2px); box-shadow: 0 6px 0 var(--primary-dark); } }
.tools { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.tool { display: inline-flex; align-items: center; gap: 4px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--ink-soft); font: 900 12px/1 var(--font); cursor: pointer; white-space: nowrap; }

.combo { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 30; padding: 8px 18px; border-radius: 999px; font-weight: 900; color: #1f1b16; pointer-events: none; white-space: nowrap; animation: combo .9s ease-out forwards; box-shadow: 0 6px 18px rgba(43, 38, 32, .2); }
.combo.l0 { background: var(--l0); } .combo.l1 { background: var(--l1); } .combo.l2 { background: var(--l2); } .combo.l3 { background: var(--l3); }
@keyframes combo { 0% { transform: translate(-50%, -30%) scale(.6); opacity: 0; } 25% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(-50%, -90%) scale(1); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .band, .tile.shake, .tile.pop, .lives i.drop, .act.go.ready, .combo { animation: none !important; }
  .combo { opacity: 0; }
}

/* タイトル・結果（盤を隠して全体を見せる） */
.play.menu .bar, .play.menu .found, .play.menu .grid, .play.menu .msg, .play.menu .acts, .play.menu .tools { display: none; }
.card-ui { width: 100%; max-width: 420px; margin: 0 auto; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 20px 16px 16px; text-align: center; box-shadow: 0 10px 30px rgba(43, 38, 32, 0.08); }
.logo { margin: 0; font: 900 27px/1.3 var(--font); letter-spacing: 0.03em; white-space: nowrap; }
.day { margin: 2px 0 12px; font-size: 13px; color: var(--ink-soft); font-weight: 900; }
.daily-box { border: 2px solid var(--primary); border-radius: 16px; padding: 12px; margin-bottom: 10px; }
.daily-lbl { font-size: 11px; font-weight: 900; color: var(--ink-soft); letter-spacing: 0.1em; }
.daily-lead { margin: 2px 0 8px; font: 900 18px/1.45 var(--font); color: var(--primary-dark); }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.chip { font-size: 10.5px; font-weight: 900; padding: 2px 6px; border-radius: 999px; color: #1f1b16; white-space: nowrap; }
.chip.l0 { background: var(--l0); } .chip.l1 { background: var(--l1); } .chip.l2 { background: var(--l2); } .chip.l3 { background: var(--l3); }
.daily-note { margin: 8px 0; font-size: 12px; color: var(--ink-soft); }
.done { font-size: 14px; font-weight: 900; margin-top: 6px; }
.free { margin-top: 4px; }
.free-lbl { font-size: 12px; font-weight: 900; color: var(--ink-soft); margin: 6px 0 4px; }
.past { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; font-size: 12px; font-weight: 900; color: var(--ink-soft); }
.past select { max-width: 60%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); font: 700 13px/1.2 var(--font); }
.howto { list-style: none; margin: 12px 0 0; padding: 10px 12px; background: var(--bg); border-radius: 12px; text-align: left; font-size: 13px; font-weight: 700; }
.howto li { display: flex; align-items: baseline; gap: 6px; padding: 3px 0; }
.howto .num { flex: none; font-weight: 900; color: var(--primary); }
.stats { font-size: 12px; color: var(--ink-soft); font-weight: 700; margin: 10px 0 0; }

.btn { display: block; width: 100%; margin: 8px 0; padding: 13px 10px; border: 0; border-radius: 14px; font: 900 16px/1.2 var(--font); cursor: pointer; background: var(--bg); color: var(--ink); }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 4px 0 var(--primary-dark); }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--primary-dark); }
.btn.lv { margin: 0; font-size: 15px; padding: 11px 2px; }
.btn.sub { font-size: 14px; }
.btn.ghost { background: transparent; border: 2px solid var(--line); color: var(--ink-soft); font-size: 14px; }
.btn.x { background: #000; color: #fff; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn:disabled { opacity: 0.5; cursor: default; }

.clear-lbl { font-size: 13px; font-weight: 900; color: var(--primary-dark); }
.clear-big { margin: 6px 0 2px; font: 900 26px/1.3 var(--font); }
.clear-big b { font-size: 44px; font-variant-numeric: tabular-nums; }
.clear-big.miss { color: var(--ink-soft); }
.clear-sub { margin: 0; font-size: 14px; font-weight: 700; }
.best { display: block; width: max-content; margin: 8px auto 0; padding: 2px 12px; border-radius: 999px; background: var(--gold); font-weight: 900; font-size: 13px; }
.near { margin: 8px 0 0; font-size: 13px; font-weight: 900; color: var(--primary-dark); }
.c-path { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 10px 0 0; }
.c-path div { display: flex; gap: 4px; }
.c-path i { width: 18px; height: 18px; border-radius: 5px; display: block; }
.c-path i.l0 { background: var(--l0); } .c-path i.l1 { background: var(--l1); } .c-path i.l2 { background: var(--l2); } .c-path i.l3 { background: var(--l3); }
.c-groups { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; text-align: left; }
.c-groups li { border-radius: 12px; padding: 6px 10px; color: #1f1b16; }
.c-groups li.l0 { background: var(--l0); } .c-groups li.l1 { background: var(--l1); } .c-groups li.l2 { background: var(--l2); } .c-groups li.l3 { background: var(--l3); }
.c-groups .g-name { font-size: 14px; font-weight: 900; line-height: 1.4; }
.c-groups .g-name > span:last-child { display: block; }
.c-groups .g-lv { display: inline-block; font-size: 10px; font-weight: 900; padding: 0 6px; border-radius: 999px; background: rgba(255, 255, 255, .65); }
.c-groups .g-words { font-size: 13px; font-weight: 700; line-height: 1.5; }
.c-groups .g-words small { font-size: 11px; color: #3b342c; }
.rank { margin: 12px 0; padding: 8px; background: var(--bg); border-radius: 14px; }
.rank-lbl { font-size: 11px; font-weight: 900; color: var(--ink-soft); }
.rank-name { font: 900 22px/1.4 var(--font); }
.c-note { margin: 8px 0; padding: 8px 10px; border-radius: 12px; background: #fff3d6; font-size: 13px; font-weight: 700; text-align: left; }
.share { margin: 8px 0; }
.next-day { margin: 6px 0 0; font-size: 13px; font-weight: 900; color: var(--ink-soft); }

.toast { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%); z-index: 40; max-width: calc(100% - 24px); padding: 10px 18px; border-radius: 16px; background: rgba(43, 38, 32, 0.92); color: #fff; font-weight: 900; font-size: 14px; text-align: center; pointer-events: none; }

/* 下の解説（ポータルと同じ決まり: 行間 1.85・段落の間は1行分・見出しは前を広く後ろを狭く） */
.guide { margin-top: 28px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 22px 20px 12px; font-size: 15px; line-height: 1.85; }
.guide p { margin: 0 0 1em; }
.guide h2 { font: 900 19px/1.4 var(--font); margin: 32px 0 12px; padding-left: 10px; border-left: 5px solid var(--primary); }
.guide h2:first-child { margin-top: 0; }
.guide h3 { font-size: 16px; margin: 22px 0 6px; line-height: 1.5; }
.guide ul { padding-left: 1.3em; margin: 0 0 1em; }
.guide li { margin: 6px 0; }
.guide .steps { list-style: none; padding: 0; }
.guide .steps li { display: flex; align-items: baseline; gap: 6px; }
.guide .steps .num { flex: none; font-weight: 900; color: var(--primary); }
.guide details { border-top: 1px solid var(--line); padding: 12px 0; }
.guide details p { margin: 8px 0 4px; }
.guide summary { font-weight: 900; cursor: pointer; }
.guide a { color: var(--primary-dark); }
.g-foot { max-width: 520px; margin: 0 auto; padding: 14px 16px 28px; font-size: 12px; text-align: center; }
.g-foot a { color: var(--ink-soft); }

.card-ui .mg-box { background: var(--bg); border-color: transparent; }
@media (max-width: 360px) {
  .c-groups .g-name, .band .b-name { font-size: 13px; }
  .lives i { width: 11px; height: 11px; }
  .lives .left { font-size: 13px; }
  main { padding: 0 8px 24px; }
  .grid { gap: 5px; }
  .tile { height: 58px; font-size: 15px; }
  .tile[data-n="5"] { font-size: 13px; }
  .tile[data-n="6"] { font-size: 11px; }
  .act { font-size: 12px; }
  .act.go { font-size: 15px; }
  .logo { font-size: 24px; }
}
