/* Ma sói – toàn bộ CSS của trò (mọi lớp dùng tiền tố masoi-, riêng ảnh trang chủ là .art-masoi). Nạp sau style.css.
   Khung cảnh: làng quê ban đêm (trăng, đèn dầu, lũy tre) và ban ngày; đổi theo pha bằng thuộc tính data-phase.
   Chế độ đêm tối màu, chữ to, nút tối thiểu 44px để dùng trong phòng tối. */

/* ---- Ảnh nhỏ trang chủ (vuông 96 x 96) ---- */
.art-masoi { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 96'%3E%3Cdefs%3E%3ClinearGradient id='s' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23141c4a'/%3E%3Cstop offset='1' stop-color='%233d4a8c'/%3E%3C/linearGradient%3E%3CradialGradient id='g' cx='.5' cy='.5' r='.5'%3E%3Cstop offset='0' stop-color='%23fff6c8' stop-opacity='.55'/%3E%3Cstop offset='1' stop-color='%23fff6c8' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='l' cx='.5' cy='.5' r='.5'%3E%3Cstop offset='0' stop-color='%23ffd25e' stop-opacity='.8'/%3E%3Cstop offset='1' stop-color='%23ffd25e' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Crect width='96' height='96' fill='url(%23s)'/%3E%3Ccircle cx='66' cy='26' r='24' fill='url(%23g)'/%3E%3Ccircle cx='66' cy='26' r='13' fill='%23fff3c4'/%3E%3Ccircle cx='61' cy='22' r='2.6' fill='%23efdf9e'/%3E%3Ccircle cx='70' cy='30' r='1.8' fill='%23efdf9e'/%3E%3Cg fill='%23fff'%3E%3Ccircle cx='12' cy='12' r='1'/%3E%3Ccircle cx='30' cy='8' r='.8'/%3E%3Ccircle cx='44' cy='20' r='1'/%3E%3Ccircle cx='88' cy='10' r='.8'/%3E%3Ccircle cx='22' cy='30' r='.7'/%3E%3Ccircle cx='86' cy='46' r='.7'/%3E%3C/g%3E%3Cpath d='M0 70c14-6 30-8 48-4s34 2 48-4v34H0z' fill='%231d2b52'/%3E%3Cg fill='none' stroke='%230f1a2e' stroke-linecap='round'%3E%3Cpath d='M8 96C6 70 8 48 14 30' stroke-width='2.4'/%3E%3Cpath d='M14 96c0-24 4-44 12-58' stroke-width='2.2'/%3E%3Cpath d='M3 96C2 76 2 60 4 44' stroke-width='2'/%3E%3C/g%3E%3Cg fill='%230f1a2e'%3E%3Cpath d='M14 30c5-2 9 0 12 3-5 1-9 0-12-3z'/%3E%3Cpath d='M14 30c-5 0-8 3-9 6 4 0 7-2 9-6z'/%3E%3Cpath d='M20 44c5-1 8 1 10 4-4 1-8 0-10-4z'/%3E%3Cpath d='M26 38c4-3 9-3 12-1-4 2-8 3-12 1z'/%3E%3Cpath d='M10 52c-4 0-7 2-9 5 4 0 7-1 9-5z'/%3E%3Cpath d='M4 44c-3-2-3-5-4-7 3 1 4 3 4 7z'/%3E%3C/g%3E%3Cpath d='M62 74l12-10 12 10z' fill='%233a2a2a'/%3E%3Crect x='65' y='73' width='18' height='12' fill='%235a4636'/%3E%3Ccircle cx='74' cy='79' r='8' fill='url(%23l)'/%3E%3Crect x='71' y='76' width='6' height='5' rx='1' fill='%23ffd25e'/%3E%3Cpath d='M0 84c20-4 40-4 60-1s26 2 36 0v13H0z' fill='%2316263a'/%3E%3Cg transform='translate(40 66)'%3E%3Cpath d='M-12 14l2-22 9 9z' fill='%238a93a8' stroke='%232a2140' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M12 14l-2-22-9 9z' fill='%238a93a8' stroke='%232a2140' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M-8-1l1-5 4 4z M8-1l-1-5-4 4z' fill='%23e9a8b4'/%3E%3Cpath d='M-15 16c0-11 7-17 15-17s15 6 15 17c0 8-7 14-15 14s-15-6-15-14z' fill='%238a93a8' stroke='%232a2140' stroke-width='1.6'/%3E%3Cpath d='M-7 21c0-4 3-6 7-6s7 2 7 6-3 7-7 7-7-3-7-7z' fill='%23e4e6ee'/%3E%3Cellipse cx='0' cy='17.5' rx='3' ry='2.2' fill='%232a2140'/%3E%3Cpath d='M-3 23q3 2.5 6 0' fill='none' stroke='%232a2140' stroke-width='1.3' stroke-linecap='round'/%3E%3Cellipse cx='-6' cy='10' rx='2.8' ry='3' fill='%23ffd34d'/%3E%3Cellipse cx='6' cy='10' rx='2.8' ry='3' fill='%23ffd34d'/%3E%3Ccircle cx='-5.6' cy='9' r='1.4' fill='%232a2140'/%3E%3Ccircle cx='6.4' cy='9' r='1.4' fill='%232a2140'/%3E%3Ccircle cx='-10' cy='19' r='2' fill='%23f08a8a' opacity='.5'/%3E%3Ccircle cx='10' cy='19' r='2' fill='%23f08a8a' opacity='.5'/%3E%3C/g%3E%3C/svg%3E") center/cover no-repeat; }

/* ---- Nền trang ---- */
body[data-scene="masoi"] { background: #0c1230; color-scheme: dark; }
body[data-scene="masoi"][data-masoi-phase="day"] { background: #cfe9f7; color-scheme: light; }
body[data-scene="masoi"] #app { max-width: 1120px; }

.masoi {
  --m-panel: rgba(13, 18, 44, .88); --m-text: #f6eedb; --m-muted: #c2baa2; --m-accent: #f3c25b; --m-accent-2: #ffdd8a;
  --m-line: rgba(243, 194, 91, .32); --m-soft: rgba(255, 255, 255, .07); --m-soft-2: rgba(255, 255, 255, .13);
  --m-go-text: #1b1630; --m-red: #ff7a7a; --m-green: #7fe0a4; --m-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color: var(--m-text); font-size: 17px;
}
.masoi[data-phase="day"] {
  --m-panel: rgba(255, 250, 238, .95); --m-text: #2b2418; --m-muted: #6a5f49; --m-accent: #b4541f; --m-accent-2: #8f3f12;
  --m-line: rgba(150, 95, 40, .35); --m-soft: rgba(120, 80, 20, .07); --m-soft-2: rgba(120, 80, 20, .14);
  --m-go-text: #fff; --m-red: #c0392b; --m-green: #23804a; --m-shadow: 0 8px 24px rgba(60, 40, 10, .18);
}
.masoi :focus-visible { outline: 3px solid var(--m-accent); outline-offset: 2px; }

/* ---- Khung cảnh ---- */
.masoi-sky { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.masoi-sky svg { width: 100%; height: 100%; display: block; }
.masoi-sky-d, .masoi-sun, .masoi-cloud { opacity: 0; transition: opacity 1.4s ease; }
.masoi-stars, .masoi-moon, .masoi-glow, .masoi-fly { transition: opacity 1.4s ease; }
.masoi[data-phase="day"] .masoi-sky-d, .masoi[data-phase="day"] .masoi-sun { opacity: 1; }
.masoi[data-phase="day"] .masoi-cloud { opacity: .9; }
.masoi[data-phase="day"] .masoi-stars, .masoi[data-phase="day"] .masoi-moon, .masoi[data-phase="day"] .masoi-glow, .masoi[data-phase="day"] .masoi-fly { opacity: 0; }
.masoi-stars { opacity: .85; }
.masoi-cloud path { fill: #fff; }
.masoi-hill2, .masoi-hill, .masoi-ground, .masoi-roof, .masoi-wall, .masoi-win, .masoi-door, .masoi-leaf { transition: fill 1.4s ease, stroke 1.4s ease; }
.masoi-bam, .masoi-roofline { transition: stroke 1.4s ease; }
.masoi-hill2 { fill: #1a2350; } .masoi-hill { fill: #141c3e; } .masoi-ground { fill: #0b1226; }
.masoi-roof { fill: #2a2236; } .masoi-roofline { stroke: #1a1424; } .masoi-wall { fill: #2b2a40; } .masoi-door { fill: #1c1a2c; }
.masoi-win { fill: #ffcf5c; }
.masoi-glow { opacity: 1; }
.masoi-bam { stroke: #0a1222; } .masoi-leaf { fill: #0a1222; }
.masoi-fly circle { fill: #fff19a; opacity: .8; }
.masoi[data-phase="day"] .masoi-hill2 { fill: #9cc77a; } .masoi[data-phase="day"] .masoi-hill { fill: #7fb35d; } .masoi[data-phase="day"] .masoi-ground { fill: #6c9d48; }
.masoi[data-phase="day"] .masoi-roof { fill: #c79a4a; } .masoi[data-phase="day"] .masoi-roofline { stroke: #8f6a2c; } .masoi[data-phase="day"] .masoi-wall { fill: #ecd9ad; }
.masoi[data-phase="day"] .masoi-door { fill: #8a5a32; } .masoi[data-phase="day"] .masoi-win { fill: #6b5532; }
.masoi[data-phase="day"] .masoi-bam { stroke: #3d7436; } .masoi[data-phase="day"] .masoi-leaf { fill: #4f8a3f; }
@media (prefers-reduced-motion: no-preference) {
  .masoi-fly circle { animation: masoi-fly 3.2s ease-in-out infinite alternate; animation-delay: var(--d); }
  .masoi-win { animation: masoi-flicker 4s ease-in-out infinite; }
}
@keyframes masoi-fly { from { transform: translate(0, 0); opacity: .15; } to { transform: translate(14px, -18px); opacity: .95; } }
@keyframes masoi-flicker { 0%, 100% { opacity: 1; } 45% { opacity: .82; } 55% { opacity: .95; } }

/* ---- Khung chung ---- */
.masoi-main { display: grid; gap: 14px; }
.masoi-panel { background: var(--m-panel); border: 1.5px solid var(--m-line); border-radius: 18px; padding: 16px; box-shadow: var(--m-shadow); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); min-width: 0; }
.masoi h1, .masoi h2, .masoi h3 { color: var(--m-text); }
.masoi h2 { font: 700 clamp(1.7rem, 6vw, 2.2rem)/1.15 var(--f-chalk); margin: 4px 0 8px; text-wrap: balance; }
.masoi-h3 { font: 600 1.25rem/1.2 var(--f-chalk); margin: 14px 0 8px; color: var(--m-accent); }
.masoi-kicker { margin: 0; font: 600 .85rem/1.3 var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--m-accent); }
.masoi-say { margin: 4px 0 12px; font-size: 1.18rem; line-height: 1.5; text-wrap: pretty; }
.masoi-hint { margin: 4px 0; font-size: .95rem; color: var(--m-muted); }
.masoi-note { font-size: .9rem; color: var(--m-muted); }
.masoi-err { margin: 4px 0; color: var(--m-red); font-weight: 600; }
.masoi-err:empty, .masoi-hint:empty { display: none; }
.masoi a.masoi-backlink { color: var(--m-accent); font-size: 1.25rem; justify-self: start; min-height: 44px; display: inline-flex; align-items: center; }

/* Nút */
.masoi .btn { min-height: 48px; font-size: 1.05rem; border-radius: 12px; box-shadow: none; }
.masoi .btn.masoi-go { background: var(--m-accent); color: var(--m-go-text); border-color: var(--m-accent); font-weight: 700; }
.masoi .btn.masoi-go:disabled { opacity: .4; cursor: not-allowed; }
.masoi .btn.masoi-ghost { background: transparent; color: var(--m-text); border-color: var(--m-line); }
.masoi .btn.masoi-ghost:hover { background: var(--m-soft); }
.masoi .btn.big { width: 100%; font-size: 1.15rem; padding: .9em 1em; }
.masoi .btn.small { min-height: 44px; font-size: .95rem; }
.masoi .btn.pulse { animation: masoi-pulse 1.2s ease-in-out infinite; }
@keyframes masoi-pulse { 50% { box-shadow: 0 0 0 8px rgba(243, 194, 91, .25); } }
.masoi-cta { display: grid; gap: 8px; margin-top: 14px; }
.masoi-ends { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* ---- Lá vai ---- */
.masoi-card { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: 100%; aspect-ratio: 5 / 7; border-radius: 14px; overflow: hidden; border: 3px solid #b9893a;
  background: linear-gradient(170deg, #fff8e2, #f1d898); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .55), 0 6px 16px rgba(0, 0, 0, .25); color: #2a2140; }
.masoi-card.masoi-t-soi { border-color: #4a3c86; background: linear-gradient(170deg, #e2dcfa, #a596dc); }
.masoi-card.masoi-t-ngo { border-color: #b5651d; background: linear-gradient(170deg, #ffeedd, #f7b98a); }
.masoi-card-team { justify-self: center; margin-top: 9%; padding: .25em .8em; border-radius: 999px; background: rgba(42, 33, 64, .1); font: 700 .78rem/1.2 var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: rgba(42, 33, 64, .75); }
.masoi-card-art { display: grid; place-items: end center; padding: 4% 6% 0; min-height: 0; background: radial-gradient(circle at 50% 62%, rgba(255, 255, 255, .75), rgba(255, 255, 255, 0) 62%); }
.masoi-card-art svg { width: 100%; height: auto; max-height: 100%; display: block; }
.masoi-card-name { font: 700 1.35rem/1.1 var(--f-chalk); text-align: center; padding: 8px 6px 10px; background: rgba(255, 255, 255, .6); border-top: 2px solid rgba(42, 33, 64, .18); }
.masoi-card.masoi-mini { width: 56px; flex: none; aspect-ratio: 1; border-width: 2px; border-radius: 10px; grid-template-rows: 1fr; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5); }
.masoi-mini .masoi-card-art { padding: 4px 4px 0; place-items: end center; }
.masoi-mini .masoi-card-name, .masoi-mini .masoi-card-team { display: none; }
.masoi-card.masoi-mini { grid-template-rows: 1fr; }
.masoi-back { border-color: #f3c25b; background: #1b2350; }
.masoi-back svg { width: 100%; height: 100%; display: block; }

/* Lật bài */
.masoi-flip { perspective: 1000px; width: min(240px, 60vw); margin: 10px auto 6px; }
.masoi-flipbtn { position: relative; display: block; width: 100%; aspect-ratio: 5 / 7; padding: 0; border: 0; background: none; cursor: pointer; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.3, .7, .3, 1); border-radius: 14px; }
.masoi-flipbtn.on { transform: rotateY(180deg); }
.masoi-flipbtn > .masoi-card, .masoi-front { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.masoi-front { transform: rotateY(180deg); }
.masoi-front .masoi-card { height: 100%; }
.masoi-roleinfo, .masoi-reveal .masoi-desc { text-align: left; }
.masoi-team { font-weight: 600; color: var(--m-accent); margin: 6px 0; }
.masoi-desc { margin: 6px 0; font-size: 1.05rem; line-height: 1.5; }

/* ---- Màn chọn ---- */
.masoi-setup { display: grid; gap: 14px; }
.masoi-head { display: flex; gap: 16px; align-items: center; }
.masoi-logo { width: 76px; height: 76px; flex: none; border-radius: 16px; border: 2px solid var(--m-accent); box-shadow: 0 0 22px rgba(243, 194, 91, .25); }
.masoi-head h1 { font: 700 clamp(2.4rem, 10vw, 3.3rem)/1 var(--f-chalk); color: var(--m-accent-2); text-shadow: 0 2px 0 rgba(0, 0, 0, .35); margin: 0; }
.masoi-head p { margin: 4px 0 0; color: var(--m-text); font-size: 1.05rem; }
.masoi[data-phase="night"] .masoi-head p, .masoi[data-phase="night"] .masoi-backlink, .masoi[data-phase="night"] .masoi-bt { text-shadow: 0 1px 3px rgba(5, 8, 25, .95), 0 0 10px rgba(5, 8, 25, .8); }
.masoi-cols { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .masoi-cols { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); } }
.masoi-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; background: var(--m-soft); border-radius: 14px; margin-bottom: 12px; }
.masoi-tabs button { min-height: 48px; border: 0; border-radius: 10px; background: transparent; color: var(--m-muted); font: 600 1.05rem var(--f-body); cursor: pointer; }
.masoi-tabs button[aria-selected="true"] { background: var(--m-accent); color: var(--m-go-text); }
.masoi-pane { display: grid; gap: 10px; }
.masoi-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.masoi-lbl { font-weight: 600; }
.masoi-step { display: inline-flex; align-items: center; gap: 6px; }
.masoi-sbtn { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--m-accent); background: transparent; color: var(--m-text); font: 600 1.5rem/1 var(--f-body); cursor: pointer; }
.masoi-sbtn:active { background: var(--m-soft-2); }
.masoi-step output { min-width: 2.2ch; text-align: center; font: 700 1.7rem/1 var(--f-chalk); color: var(--m-accent-2); }
.masoi-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.masoi-seg button { min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--m-line); background: var(--m-soft); color: var(--m-text); font: 600 .98rem var(--f-body); cursor: pointer; }
.masoi-seg button[aria-checked="true"] { background: var(--m-accent); color: var(--m-go-text); border-color: var(--m-accent); }
.masoi-roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.masoi-rt { display: grid; justify-items: center; gap: 6px; padding: 10px 4px 8px; border-radius: 14px; border: 2px dashed var(--m-line); background: transparent; color: var(--m-muted); font: 600 .9rem/1.15 var(--f-body); cursor: pointer; min-height: 44px; }
.masoi-rt .masoi-mini { width: 60px; filter: grayscale(.85); opacity: .55; transition: filter .2s, opacity .2s; }
.masoi-rt[aria-pressed="true"] { border-style: solid; border-color: var(--m-accent); background: var(--m-soft); color: var(--m-text); }
.masoi-rt[aria-pressed="true"] .masoi-mini { filter: none; opacity: 1; }
.masoi-deck { display: grid; gap: 6px; padding: 12px; border-radius: 14px; background: var(--m-soft); }
.masoi-deck .btn { justify-self: start; }
.masoi-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.masoi-chip { font: 600 .88rem/1 var(--f-body); padding: .45em .75em; border-radius: 999px; background: #f6e3b0; color: #4a3410; }
.masoi-chip.masoi-t-soi { background: #c9bdf2; color: #2c2160; }
.masoi-chip.masoi-t-ngo { background: #f7c9a0; color: #6a3410; }
.masoi-bal { margin: 0; font-size: .95rem; color: var(--m-text); }
.masoi-chk { display: flex; gap: 12px; align-items: center; min-height: 44px; cursor: pointer; font-size: 1.02rem; }
.masoi-chk input { width: 22px; height: 22px; accent-color: var(--m-accent); flex: none; }
.masoi-names summary, .masoi-rules summary, .masoi-log summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font: 600 1.2rem var(--f-chalk); color: var(--m-accent); }
.masoi-ngrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding-top: 6px; }
.masoi-name { display: flex; align-items: center; gap: 8px; }
.masoi-name span { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--m-soft-2); font-size: .85rem; font-weight: 700; }
.masoi-name input { min-width: 0; width: 100%; min-height: 44px; padding: 0 10px; border-radius: 10px; border: 1.5px solid var(--m-line); background: var(--m-soft); color: var(--m-text); font: 500 1.05rem var(--f-body); }
.masoi-name input::placeholder { color: var(--m-muted); opacity: .8; }
.masoi-conf .masoi-cta { position: sticky; bottom: 0; margin: 6px -16px -16px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(rgba(13, 18, 44, 0), var(--m-panel) 30%); border-radius: 0 0 18px 18px; }
.masoi-stat { margin: 14px 0 0; color: var(--m-accent); font-size: .95rem; }
.masoi-villagers { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.masoi-vg { display: grid; justify-items: center; text-align: center; gap: 2px; padding: 8px 4px; border-radius: 12px; background: var(--m-soft); }
.masoi-vg b { font-size: .95rem; } .masoi-vg small { font-size: .78rem; color: var(--m-muted); }
.masoi-av { display: inline-block; width: 44px; height: 44px; border-radius: 50%; background: #f7e6c1; overflow: hidden; flex: none; border: 2px solid rgba(255, 255, 255, .5); }
.masoi-av svg { width: 100%; height: 100%; display: block; }
.masoi-rules details { font-size: 1rem; }
.masoi-rules h3 { font: 600 1.2rem var(--f-chalk); color: var(--m-accent); margin: 16px 0 6px; }
.masoi-rules p, .masoi-rules li { line-height: 1.55; }
.masoi-rules ul:not(.masoi-rolelist) { padding-left: 1.2em; }
.masoi-rolelist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.masoi-rolelist li { display: flex; gap: 12px; align-items: flex-start; }
.masoi-rolelist b { display: block; font-size: 1.05rem; }
.masoi-rolelist span { font-size: .95rem; color: var(--m-text); opacity: .9; }

/* ---- Màn chơi ---- */
.masoi-play { display: grid; gap: 12px; max-width: 760px; width: 100%; margin: 0 auto; }
.masoi-play.masoi-ai, .masoi-play.masoi-end { max-width: 1100px; }
.masoi-bar { display: flex; align-items: center; gap: 10px; }
.masoi-ib { min-width: 48px; min-height: 48px; padding: 0 12px; border-radius: 12px; border: 1.5px solid var(--m-line); background: var(--m-panel); color: var(--m-text); font: 600 1.05rem var(--f-body); cursor: pointer; }
.masoi-quit { font-size: 1.5rem; }
.masoi-quit.sure { font-size: 1rem; background: var(--m-red); color: #fff; border-color: var(--m-red); }
.masoi-bt { flex: 1; min-width: 0; display: grid; }
.masoi-bt b { font: 700 1.6rem/1.05 var(--f-chalk); color: var(--m-accent-2); text-shadow: 0 1px 0 rgba(0, 0, 0, .3); }
.masoi[data-phase="day"] .masoi-bt b { text-shadow: 0 1px 0 rgba(255, 255, 255, .6); }
.masoi-sub { font-size: .9rem; color: var(--m-text); opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.masoi-big { text-align: center; padding: 22px 18px; }
.masoi-big .masoi-say { font-size: 1.25rem; }
.masoi-hname { font-size: clamp(2.2rem, 10vw, 3rem) !important; color: var(--m-accent-2) !important; }
.masoi-sh { display: flex; gap: 14px; align-items: center; text-align: left; margin-bottom: 6px; }
.masoi-sh .masoi-mini { width: 68px; }
.masoi-sh h2 { margin: 2px 0 0; }
.masoi-body { display: grid; gap: 8px; }
.masoi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; text-align: left; }
.masoi-pbtn { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-height: 58px; padding: 8px 12px; border-radius: 14px; border: 2px solid var(--m-line); background: var(--m-soft); color: var(--m-text); font: 600 1.12rem/1.2 var(--f-body); cursor: pointer; text-align: left; }
.masoi-pbtn .masoi-pn { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.masoi-pbtn small { flex-basis: 100%; font-size: .8rem; font-weight: 500; color: var(--m-muted); }
.masoi-pbtn[aria-pressed="true"] { background: var(--m-accent); border-color: var(--m-accent); color: var(--m-go-text); }
.masoi-pbtn[aria-pressed="true"] .masoi-num { background: rgba(0, 0, 0, .15); color: inherit; }
.masoi-pbtn:disabled { opacity: .42; cursor: not-allowed; }
.masoi-num { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--m-soft-2); color: var(--m-accent-2); font: 700 .95rem var(--f-body); }
.masoi-verdict { display: grid; gap: 6px; padding: 22px 12px; border-radius: 18px; margin: 6px 0; }
.masoi-verdict b { font: 700 clamp(1.9rem, 8vw, 2.5rem)/1.1 var(--f-chalk); }
.masoi-verdict span { font: 800 clamp(1.5rem, 6vw, 2rem)/1.1 var(--f-body); letter-spacing: .04em; }
.masoi-verdict.is-wolf { background: #7d1f2a; color: #ffe1e1; border: 3px solid #ff7a7a; }
.masoi-verdict.is-good { background: #1d5c3a; color: #e1ffec; border: 3px solid #7fe0a4; }
.masoi-couple { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 14px; font: 700 clamp(1.7rem, 7vw, 2.3rem)/1.2 var(--f-chalk); color: var(--m-accent-2); margin: 10px 0; }
.masoi-heart { color: #ff6f91; }
.masoi-target { font: 700 clamp(2rem, 9vw, 2.6rem)/1.15 var(--f-chalk); color: var(--m-accent-2); margin: 4px 0 10px; }
.masoi-pots { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 6px 0; }
.masoi-pots span { padding: .4em .9em; border-radius: 999px; background: var(--m-soft-2); font-weight: 600; }
.masoi-pots span.used { opacity: .5; text-decoration: line-through; }
.masoi-wait { height: 10px; border-radius: 999px; background: var(--m-soft-2); overflow: hidden; margin: 16px auto 6px; max-width: 320px; }
.masoi-wait span { display: block; height: 100%; width: 40%; border-radius: inherit; background: var(--m-accent); }
@media (prefers-reduced-motion: no-preference) { .masoi-wait span { animation: masoi-slide 1.6s ease-in-out infinite alternate; } }
@keyframes masoi-slide { from { transform: translateX(-20%); } to { transform: translateX(170%); } }
.masoi-moonbig, .masoi-sunbig { width: 92px; height: 92px; margin: 0 auto 10px; border-radius: 50%; }
.masoi-moonbig { background: #fff3c4; box-shadow: 0 0 40px rgba(255, 243, 196, .45), inset -18px -6px 0 rgba(239, 223, 158, .55); }
.masoi-sunbig { background: #ffd95a; box-shadow: 0 0 0 10px rgba(255, 217, 90, .25), 0 0 40px rgba(255, 190, 60, .55); }
.masoi-deaths { list-style: none; margin: 10px auto; padding: 0; display: grid; gap: 10px; max-width: 420px; text-align: left; }
.masoi-deaths li { display: flex; gap: 14px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--m-soft); }
.masoi-deaths b { display: block; font: 700 1.5rem/1.15 var(--f-chalk); }
.masoi-deaths span { color: var(--m-muted); }
.masoi-rip { width: 50px; height: 58px; flex: none; border-radius: 26px 26px 6px 6px; background: #8f95a6; border: 2px solid #4b5063; position: relative; }
.masoi-rip::after { content: ""; position: absolute; left: 50%; top: 12px; width: 4px; height: 24px; margin-left: -2px; background: #4b5063; box-shadow: 0 6px 0 0 transparent; }
.masoi-rip::before { content: ""; position: absolute; left: 50%; top: 19px; width: 18px; height: 4px; margin-left: -9px; background: #4b5063; }
.masoi-clock { margin: 4px 0; }
.masoi-clock span { font: 700 clamp(4rem, 22vw, 6.5rem)/1 var(--f-chalk); font-variant-numeric: tabular-nums; color: var(--m-accent-2); }
.masoi-clock.low span { color: var(--m-red); }
.masoi-tbtns { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.masoi-strip { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; text-align: left; }
.masoi-strip li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 6px 8px; border-radius: 10px; background: var(--m-soft); font-size: .98rem; }
.masoi-strip li.dead .masoi-sn { text-decoration: line-through; opacity: .6; }
.masoi-tag { display: inline-block; font: 600 .74rem/1.2 var(--f-body); font-style: normal; padding: .2em .55em; border-radius: 999px; background: var(--m-accent); color: var(--m-go-text); }
.masoi-tag.dim { background: var(--m-soft-2); color: var(--m-text); }
.masoi-tag.wolf { background: #6b4fa0; color: #fff; }
.masoi-tag.good { background: #2f8a55; color: #fff; }
.masoi-tag.love { background: #e8557a; color: #fff; }
.masoi-tag.me { background: #3b6fb6; color: #fff; }

/* ---- Chơi với máy ---- */
.masoi-aigrid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .masoi-aigrid { grid-template-columns: 300px minmax(0, 1fr); } .masoi-people { position: sticky; top: 12px; } }
.masoi-people { padding: 12px; }
.masoi-people .masoi-h3 { margin: 0 0 8px; }
.masoi-plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
@media (max-width: 899.98px) {
  .masoi-stage { order: -1; }
  .masoi-plist .masoi-av { width: 38px; height: 38px; }
  .masoi-pi small { display: none; }
}
.masoi-plist li { display: grid; justify-items: center; text-align: center; gap: 2px; padding: 6px 2px; border-radius: 12px; background: var(--m-soft); min-width: 0; }
.masoi-plist li.me { box-shadow: inset 0 0 0 2px var(--m-accent); }
.masoi-plist li.dead .masoi-av { filter: grayscale(1); opacity: .5; }
.masoi-plist li.dead b { text-decoration: line-through; opacity: .6; }
.masoi-pi { display: grid; justify-items: center; gap: 1px; min-width: 0; max-width: 100%; }
.masoi-pi b { font-size: .9rem; line-height: 1.2; overflow-wrap: anywhere; }
.masoi-pi small { font-size: .72rem; color: var(--m-muted); }
.masoi-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
.masoi-tags .masoi-tag { font-size: .66rem; }
@media (min-width: 900px) {
  .masoi-plist { grid-template-columns: minmax(0, 1fr); }
  .masoi-plist li { display: flex; text-align: left; justify-items: start; gap: 10px; padding: 6px 8px; }
  .masoi-pi { justify-items: start; } .masoi-tags { justify-content: flex-start; }
  .masoi-pi b { font-size: 1rem; } .masoi-tags .masoi-tag { font-size: .72rem; }
}
.masoi-stage { display: grid; gap: 0; padding: 0; overflow: hidden; }
.masoi-chat { max-height: min(46vh, 420px); min-height: 120px; overflow-y: auto; padding: 12px 14px; overscroll-behavior: contain; }
@media (min-width: 900px) { .masoi-chat { max-height: 52vh; min-height: 260px; } }
.masoi-chat ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.masoi-msg { display: flex; gap: 10px; align-items: flex-start; }
.masoi-msg .masoi-av { width: 38px; height: 38px; }
.masoi-msg > div { min-width: 0; max-width: 88%; background: var(--m-soft-2); border-radius: 4px 14px 14px 14px; padding: 6px 12px 8px; }
.masoi-msg b { font-size: .85rem; color: var(--m-accent); }
.masoi-msg p { margin: 2px 0 0; font-size: 1.05rem; line-height: 1.45; overflow-wrap: anywhere; }
.masoi-msg.mine { flex-direction: row-reverse; }
.masoi-msg.mine > div { background: var(--m-accent); color: var(--m-go-text); border-radius: 14px 4px 14px 14px; }
.masoi-msg.mine b { color: inherit; opacity: .8; }
.masoi-sys { text-align: center; font-size: .98rem; color: var(--m-text); opacity: .92; padding: 2px 8px; }
.masoi-sys.death { color: var(--m-red); opacity: 1; }
.masoi-sys.warn { color: var(--m-accent-2); font-weight: 600; opacity: 1; }
.masoi-sys.sep { display: flex; align-items: center; gap: 10px; font: 700 1rem var(--f-chalk); color: var(--m-accent); opacity: 1; }
.masoi-sys.sep::before, .masoi-sys.sep::after { content: ""; flex: 1; height: 1.5px; background: var(--m-line); }
@media (prefers-reduced-motion: no-preference) { .masoi-chat li.in { animation: masoi-in .3s ease-out; } }
@keyframes masoi-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.masoi-act { border-top: 1.5px solid var(--m-line); padding: 14px; display: grid; gap: 6px; }
.masoi-act .masoi-cta { margin-top: 6px; }
.masoi-says { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.masoi-votes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; font-size: 1rem; }
.masoi-reveal { display: grid; gap: 12px; align-items: center; }
.masoi-reveal .masoi-flip { width: min(200px, 52vw); margin: 0 auto; }
.masoi-reveal .masoi-flipbtn { cursor: default; }
@media (min-width: 640px) { .masoi-reveal { grid-template-columns: 200px minmax(0, 1fr); } }

/* ---- Kết thúc ---- */
.masoi-result h2 { font-size: clamp(2rem, 8vw, 2.8rem); color: var(--m-accent-2); }
.masoi-stamp { justify-self: center; margin: 0 auto 6px; width: 96px; height: 96px; display: grid; place-items: center; border-radius: 50%; border: 3px solid var(--m-accent); color: var(--m-accent); font: 700 1.6rem var(--f-chalk); transform: rotate(-12deg); }
.masoi-stamp.lose { border-color: var(--m-red); color: var(--m-red); }
.masoi-all { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
.masoi-all li { display: grid; justify-items: center; text-align: center; gap: 3px; padding: 10px 6px; border-radius: 14px; background: var(--m-soft); border: 2px solid transparent; }
.masoi-all li.won { border-color: var(--m-accent); }
.masoi-all li.dead .masoi-mini { filter: grayscale(.7); opacity: .7; }
.masoi-all .masoi-mini { width: 64px; }
.masoi-all b { font-size: 1rem; overflow-wrap: anywhere; }
.masoi-all small { font-size: .8rem; color: var(--m-muted); }
.masoi-log h4 { margin: 12px 0 4px; font: 700 1.1rem var(--f-chalk); color: var(--m-accent); }
.masoi-log ul { margin: 0; padding-left: 1.2em; display: grid; gap: 2px; }
.masoi-log li { font-size: .98rem; line-height: 1.45; }
.masoi-l-death { color: var(--m-red); }
.masoi-l-end { font-weight: 700; color: var(--m-accent); }

@media (max-width: 480px) {
  .masoi { font-size: 16px; }
  .masoi-panel { padding: 14px 12px; }
  .masoi-conf .masoi-cta { margin: 6px -12px -14px; padding-left: 12px; padding-right: 12px; }
  .masoi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .masoi-says { grid-template-columns: 1fr 1fr; }
  .masoi-big { padding: 18px 12px; }
}
@media (prefers-reduced-motion: reduce) { .masoi-flipbtn { transition: none; } }

/* ---- Ván đang dở ---- */
.masoi-resume { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; border: 2px solid var(--m-accent); box-shadow: 0 0 0 4px rgba(243, 194, 91, .15), var(--m-shadow); }
.masoi-rl { margin: 4px 0 0; font: 600 1.15rem/1.35 var(--f-body); }
.masoi-rbtns { display: flex; flex-wrap: wrap; gap: 8px; }
.masoi-rbtns .btn { min-width: 132px; }
@media (max-width: 480px) { .masoi-rbtns { width: 100%; } .masoi-rbtns .btn { flex: 1; min-width: 0; } }

/* ================= Điện thoại xoay ngang ================= */
/* Màn chơi gói trong một màn hình: chơi với máy chia hai cột (dân làng | trò chuyện + lựa chọn), mỗi danh sách dài tự cuộn trong khung của nó. */
@media (orientation: landscape) and (max-height: 540px) {
  body[data-scene="masoi"] #app { max-width: none; }
  .masoi-play { gap: 8px; max-width: none; }
  .masoi-ib { min-width: 44px; min-height: 44px; }
  .masoi-bar .rot-btn { min-height: 44px; }
  .masoi-bt b { font-size: 1.3rem; }
  .masoi-sub { font-size: .82rem; }
  .masoi h2 { font-size: 1.5rem; margin: 2px 0 6px; }
  .masoi-say { font-size: 1.05rem; margin: 2px 0 8px; }
  .masoi .btn { min-height: 44px; }
  .masoi .btn.big { padding: .55em 1em; }
  .masoi-cta { margin-top: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .masoi-sh .masoi-mini { width: 48px; }
  .masoi-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 6px; }
  .masoi-pbtn { min-height: 46px; padding: 6px 10px; font-size: 1.02rem; }
  .masoi-says { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }

  /* Chơi với máy */
  .masoi-play.masoi-ai { height: calc(100dvh - 18px); grid-template-rows: auto minmax(0, 1fr); }
  .masoi-aigrid { grid-template-columns: minmax(170px, 27%) minmax(0, 1fr); gap: 10px; min-height: 0; height: 100%; }
  .masoi-people { position: static; height: 100%; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px; }
  .masoi-plist { grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 4px; }
  .masoi-plist .masoi-av { width: 34px; height: 34px; }
  .masoi-stage { order: 0; display: flex; flex-direction: column; height: 100%; min-height: 0; }
  .masoi-chat { flex: 1 1 96px; min-height: 96px; max-height: none; padding: 8px 12px; }
  .masoi-act { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 10px 12px; }
  .masoi-act:empty { display: none; }
  .masoi-msg p { font-size: 1rem; }
  .masoi-reveal { grid-template-columns: 120px minmax(0, 1fr); }
  .masoi-reveal .masoi-flip { width: 120px; }

  /* Quản trò hộ: khung chính cao tối đa bằng màn hình, nội dung dài tự cuộn */
  .masoi-big { max-height: calc(100dvh - 82px); overflow-y: auto; overscroll-behavior: contain; padding: 12px 16px; }
  .masoi-big .masoi-say { font-size: 1.08rem; }
  .masoi-big .masoi-cta { position: sticky; bottom: -12px; z-index: 1; margin: 6px -16px -12px; padding: 10px 16px 12px; background: linear-gradient(transparent, var(--m-panel) 14px); }
  .masoi-hname { font-size: 1.9rem !important; }
  .masoi-big:has(> .masoi-flip) { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 20px; align-content: center; text-align: left; }
  .masoi-big:has(> .masoi-flip) > * { grid-column: 2; }
  .masoi-big > .masoi-flip { grid-column: 1; grid-row: 1 / span 6; align-self: center; width: min(150px, calc((100dvh - 120px) * 5 / 7)); margin: 0; }
  .masoi-big .masoi-desc { font-size: .98rem; margin: 2px 0; }
  .masoi-big .masoi-team { margin: 2px 0; }
  .masoi-moonbig, .masoi-sunbig { width: 60px; height: 60px; margin-bottom: 6px; }
  .masoi-clock span { font-size: 3.6rem; }
  /* Thảo luận: đồng hồ + nút bên trái, danh sách người còn sống bên phải tự cuộn */
  .masoi-big:has(> .masoi-clock) { display: grid; grid-template-columns: minmax(200px, 40%) minmax(0, 1fr); grid-auto-rows: auto; column-gap: 16px; align-content: center; }
  .masoi-big:has(> .masoi-clock) > * { grid-column: 1; }
  .masoi-big:has(> .masoi-clock) > .masoi-strip { grid-column: 2; grid-row: 1 / span 5; align-self: start; margin: 0; max-height: calc(100dvh - 110px); overflow-y: auto; overscroll-behavior: contain; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .masoi-big:has(> .masoi-clock) .masoi-tbtns { margin-bottom: 0; }
  .masoi-verdict { padding: 8px 12px; gap: 2px; margin: 4px 0; }
  .masoi-verdict b { font-size: 1.6rem; }
  .masoi-verdict span { font-size: 1.3rem; }
  .masoi-target { font-size: 1.8rem; margin: 2px 0 6px; }
  .masoi-couple { font-size: 1.6rem; margin: 4px 0; }
  .masoi-sh { margin-bottom: 2px; }
  .masoi-deaths { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); max-width: none; }
}
