:root {
  --ink: #1f2d2a;
  --ink-soft: #5b6b67;
  --bg: #e6f1ee;
  --paper: #fdfefd;
  --line: #cfe2dc;
  --primary: #1d6b5c;
  --primary-dark: #124a3f;
  --felt: #2f7d66;
  --felt-dark: #23604f;
  --gold: #ffd34d;
  --hold: #ffb547;
  --font: "Zen Maru Gothic", system-ui, sans-serif;
  --num: "Mochiy Pop One", "Zen Maru Gothic", 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: 540px; 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: 540px; margin: 0 auto; padding: 0 12px 24px; }
.play { position: relative; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

.bar { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 8px; margin-bottom: 6px; }
.box { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 5px 6px; 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: 400 22px/1.2 var(--num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.val.sm { font: 900 16px/1.6 var(--font); color: #a5600e; }
.note { margin: 0 0 6px; min-height: 1.6em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 900; color: var(--primary-dark); text-align: center; }
.note.warn { color: #b3402e; }

/* サイコロの台 */
.tray { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 14px 10px 22px; border-radius: 18px; background: radial-gradient(ellipse at 50% 30%, var(--felt), var(--felt-dark)); box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.25); }
.die { position: relative; aspect-ratio: 1; border: 0; padding: 0; background: none; cursor: pointer; touch-action: manipulation; transition: transform 0.12s; }
.die svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.3)); }
.die.held { transform: translateY(-6px); }
.die.held svg rect.face { stroke: var(--hold); stroke-width: 6; }
.die .tag { position: absolute; left: 50%; bottom: -19px; transform: translateX(-50%); font-size: 11px; font-weight: 900; color: #fff; white-space: nowrap; }
.die.held .tag { color: var(--hold); }
.die.blank { cursor: default; opacity: 0.45; }
.die.spin svg { animation: spin 0.42s ease-out; }
@keyframes spin { 0% { transform: rotate(-30deg) scale(0.8); } 60% { transform: rotate(12deg) scale(1.06); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .die.spin svg { animation: none; } .die { transition: none; } }
.pip { fill: #1f2d2a; }
.face { fill: #fffdf6; stroke: #c9c2ae; stroke-width: 3; }
.btn.roll { margin: 10px 0 8px; background: var(--hold); color: #3b2500; box-shadow: 0 4px 0 #b97a1d; font-size: 18px; }
.btn.roll:active { transform: translateY(2px); box-shadow: 0 2px 0 #b97a1d; }

/* 役の表 */
.sheet { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-size: 14px; }
.sheet td { background: var(--paper); padding: 6px 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sheet td:first-child { border-left: 1px solid var(--line); border-radius: 10px 0 0 10px; font-weight: 900; white-space: nowrap; }
.sheet td:last-child { border-right: 1px solid var(--line); border-radius: 0 10px 10px 0; text-align: right; width: 70px; font: 400 18px/1.2 var(--num); font-variant-numeric: tabular-nums; }
.sheet td.mid { font-size: 11px; color: var(--ink-soft); line-height: 1.3; }
.sheet tr.row { cursor: pointer; }
.sheet tr.row.open td:last-child { color: #9aa7a3; }
.sheet tr.row.open.good td:last-child { color: var(--primary); }
.sheet tr.row.open.zero td:last-child { color: #c6cfcc; }
.sheet tr.row.used td { background: #eef4f2; cursor: default; }
.sheet tr.row.sel td { background: #fff1d6; border-color: var(--hold); }
.sheet tr.row.sel td:last-child { color: #a5600e; }
.sheet tr.row.today td:first-child::after { content: "×2"; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: #ffe6b3; color: #a5600e; font-size: 11px; }
.sheet tr.sum td { background: transparent; border: 0; font-size: 12px; color: var(--ink-soft); padding: 0 8px 4px; }
.sheet tr.sum td:last-child { font: 900 13px/1.2 var(--font); width: auto; }
.sheet tr.sum.got td:last-child { color: var(--primary); }
.tools { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 8px; }
.tool { display: inline-flex; flex-direction: row; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); font: 900 13px/1 var(--font); cursor: pointer; white-space: nowrap; touch-action: manipulation; }

/* タイトル・結果 */
.play.menu .bar, .play.menu .note, .play.menu .tray, .play.menu .btn.roll, .play.menu .sheet, .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: 18px 16px 16px; text-align: center; box-shadow: 0 10px 30px rgba(20, 70, 60, 0.1); }
.logo-art { display: flex; justify-content: center; }
.logo { margin: 0; font: 400 28px/1.3 var(--num); letter-spacing: 0.04em; white-space: nowrap; color: var(--primary-dark); }
.day { margin: 2px 0 10px; 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-name { font: 900 20px/1.4 var(--font); color: var(--primary-dark); }
.daily-note { margin: 6px 0 8px; font-size: 12px; color: var(--ink-soft); }
.done { font-size: 14px; font-weight: 900; margin-top: 6px; }
.free-lbl { font-size: 12px; font-weight: 900; color: var(--ink-soft); margin: 6px 0 4px; }
.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); touch-action: manipulation; }
.btn small { display: block; font-size: 11px; font-weight: 700; color: var(--ink-soft); margin-top: 3px; }
.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: 10px 2px; background: #d8ece6; }
.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; font: 400 56px/1.1 var(--num); font-variant-numeric: tabular-nums; }
.clear-big small { font: 900 18px/1 var(--font); margin-left: 4px; }
.clear-sub { margin: 0; font-size: 14px; font-weight: 700; }
.c-sheet { margin: 10px auto 0; border-collapse: collapse; font-size: 13px; font-weight: 700; min-width: 240px; }
.c-sheet td { padding: 2px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.c-sheet td:last-child { text-align: right; font-weight: 900; font-variant-numeric: tabular-nums; }
.c-sheet tr.today td { color: #a5600e; }
.c-sheet tr.tot td { border-bottom: 0; font-size: 15px; }
.best { display: inline-block; margin: 8px 4px 0; padding: 2px 12px; border-radius: 999px; background: var(--gold); font-weight: 900; font-size: 13px; }
.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); }
.rank-basis { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.c-note { margin: 8px 0; padding: 8px 10px; border-radius: 12px; background: #fff6dd; font-size: 13px; font-weight: 700; text-align: left; }
.share { margin: 8px 0; }
.pstreak { display: inline-block; margin: 8px 4px 0; padding: 2px 12px; border-radius: 999px; background: #e6f6ee; color: #1f6b47; font-weight: 900; font-size: 13px; }

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

/* 下の解説 */
.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 { display: flex; align-items: baseline; gap: 2px; font-size: 16px; margin: 22px 0 6px; line-height: 1.5; }
.guide h3 .num { flex: none; }
.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: 540px; 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) { main { padding: 0 8px 24px; } .sheet { font-size: 13px; } .sheet td.mid { display: none; } }
/* スマホ: 表を詰めて、サイコロと表が1画面に入るように（役の説明は下の解説と、押したときの知らせで） */
@media (max-width: 540px) { .sheet td.mid { font-size: 0; padding: 0; width: 0; } .sheet { border-spacing: 0 3px; } .sheet td { padding: 3px 10px; } .tray { padding: 10px 10px 20px; } .btn.roll { margin: 8px 0 6px; padding: 11px 10px; font-size: 16px; } }

html.yacht-play .g-head { display: none; }
html.yacht-play main { padding: 6px 8px 24px; }
