/* Sikelia — controller sul telefono */
body { font-size: 16px; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
/* niente zoom accidentale (doppio tocco / pizzico): solo tocchi e scorrimento */
html, body, button, .trow, .tabs, .foot { touch-action: manipulation; }
body { -webkit-text-size-adjust: 100%; -webkit-user-select: none; user-select: none; }
input { -webkit-user-select: text; user-select: text; }
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 16px 16px; }

/* ingresso */
#join { justify-content: center; align-items: center; padding: 24px 16px; }
.join-title { font-size: 46px; }
.join-sub { margin: 4px 0 24px; color: var(--muted); letter-spacing: .08em; }
#join-form { width: 100%; max-width: 380px; }

.card { background: var(--panel); border: 1px solid var(--panel-line); border-radius: 16px; padding: 14px; margin-bottom: 12px; }
label, .label { display: block; font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
input { display: block; width: 100%; margin-top: 6px; font: 800 18px var(--font); color: var(--cream); background: rgba(255,255,255,.08); border: 1px solid var(--panel-line); border-radius: 10px; padding: 12px; text-transform: none; letter-spacing: 0; }
#join-code { text-transform: uppercase; letter-spacing: .3em; font-size: 26px; text-align: center; }
input:focus { outline: 2px solid var(--gold); }

.btn { font: 800 16px var(--font); color: var(--cream); background: rgba(255,255,255,.1); border: 1px solid var(--panel-line); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; }
.btn.primary { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: none; }
.btn.big { width: 100%; padding: 16px; font-size: 18px; }
.btn.small { padding: 8px 12px; font-size: 15px; }
.btn.wide { flex: 1; }

.bar { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: rgba(11,34,51,.95); border-bottom: 1px solid var(--panel-line); }
.bar .brand.small { font-size: 18px; }
.bar .room { margin-left: auto; color: var(--muted); }
.bar .room b { color: var(--gold); letter-spacing: .15em; }
.foot { flex: 0 0 auto; display: flex; gap: 10px; align-items: center; padding: 10px 16px; background: rgba(11,34,51,.95); border-top: 1px solid var(--panel-line); }
.foot:empty { display: none; }
.wait { color: var(--muted); font-size: 14px; }

/* lobby */
.colors { display: flex; gap: 10px; flex-wrap: wrap; }
.colors button { width: 44px; height: 44px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); cursor: pointer; }
.colors button.on { border-color: #fff; box-shadow: 0 0 0 3px var(--gold); }
.colors button:disabled { opacity: .25; }
.plist { list-style: none; margin: 0 0 10px; padding: 0; }
.plist li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-weight: 800; }
.plist li .tag { font-size: 12px; color: var(--muted); font-weight: 700; }
.plist li .x { margin-left: auto; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.seg button { flex: 1 1 auto; font: 800 14px var(--font); color: var(--cream); background: rgba(255,255,255,.08); border: 1px solid var(--panel-line); border-radius: 10px; padding: 10px 8px; }
.seg button.on { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.switch { display: flex; align-items: center; gap: 10px; text-transform: none; font-size: 15px; color: var(--cream); letter-spacing: 0; }
.switch input { width: 22px; height: 22px; margin: 0; }

/* partita */
.status { flex-wrap: wrap; gap: 6px 10px; }
.status .me { font-weight: 900; display: flex; align-items: center; gap: 8px; }
.status .turn { margin-left: auto; font-size: 14px; font-weight: 800; padding: 4px 10px; border-radius: 20px; background: rgba(255,255,255,.1); }
.status .turn.mine { background: var(--gold); color: var(--ink); }
.tabs-body { flex: 1; position: relative; min-height: 0; display: flex; }
.tab { flex: 1; min-height: 0; }
.tabs { flex: 0 0 auto; display: flex; background: #08192a; border-top: 1px solid var(--panel-line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; position: relative; background: none; border: 0; color: var(--muted); font-size: 20px; padding: 8px 0 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabs button span { font: 800 11px var(--font); letter-spacing: .05em; }
.tabs button.on { color: var(--gold); }
.tabs button i { position: absolute; top: 4px; left: 56%; font: 900 11px var(--font); font-style: normal; background: var(--gold); color: var(--ink); border-radius: 10px; padding: 0 6px; }
.tabs button i:empty { display: none; }

h2.step { margin: 4px 0 10px; font-size: 20px; }
p.sub { margin: -4px 0 12px; color: var(--muted); font-size: 14px; }
.big-num { font-size: 40px; font-weight: 900; color: var(--gold); line-height: 1; }
.pool { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.pool .why { font-size: 13px; color: var(--muted); line-height: 1.4; }

.tlist { list-style: none; margin: 0; padding: 0; }
.tlist .prov { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.trow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 6px; border-radius: 12px; background: rgba(255,255,255,.07); border: 2px solid transparent; cursor: pointer; }
.trow.sel { border-color: var(--gold); background: rgba(232,194,46,.14); }
.trow .tn { flex: 1; font-weight: 800; line-height: 1.2; }
.trow .tn small { display: block; font-weight: 700; font-size: 12px; color: var(--muted); }
.trow .arm { font-weight: 900; font-size: 18px; min-width: 2.2em; text-align: right; }
.trow .arm .plus { color: var(--gold); font-size: 14px; }
.trow .btns { display: flex; gap: 6px; }
.trow .btns .btn { padding: 8px 11px; font-size: 15px; }
.front { font-size: 11px; color: #ffb4a6; font-weight: 800; }

.fight { text-align: center; padding: 14px; }
.fight .vs { display: flex; align-items: center; justify-content: center; gap: 12px; font-weight: 900; font-size: 18px; }
.fight .vs .n { font-size: 30px; color: var(--gold); display: block; }
.fight .dice { display: flex; justify-content: center; gap: 8px; font-size: 26px; margin: 10px 0 4px; }
.fight .res { color: var(--muted); font-size: 14px; min-height: 1.4em; }
.fight .res b { color: var(--gold); }
.stepper { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 14px 0; }
.stepper .btn { width: 56px; height: 56px; font-size: 26px; border-radius: 50%; padding: 0; }
.stepper .v { font-size: 44px; font-weight: 900; min-width: 2em; text-align: center; }
.row { display: flex; gap: 8px; }
.row + .row { margin-top: 8px; }
.note { color: var(--muted); font-size: 14px; line-height: 1.5; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.kcard { background: var(--cream); color: var(--ink); border-radius: 12px; padding: 10px 8px; text-align: center; font-weight: 800; box-shadow: 0 3px 8px rgba(0,0,0,.4); }
.kcard .ic { font-size: 30px; display: block; }
.kcard small { display: block; font-size: 12px; color: #6b5a45; margin-top: 4px; line-height: 1.2; }
.tris { margin-top: 14px; }
.tris .btn { width: 100%; margin-bottom: 8px; text-align: left; }

.secret { position: relative; border-radius: 14px; padding: 16px; background: linear-gradient(135deg, #3a2a14, #1d140c); border: 1px solid #8a6d4b; font-size: 17px; font-weight: 800; line-height: 1.45; min-height: 90px; }
.secret.covered .txt { filter: blur(9px); user-select: none; }
.secret .cover { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; color: var(--cream); }
.secret:not(.covered) .cover { display: none; }

/* mappa sul telefono */
#tab-map { position: relative; display: flex; flex-direction: column; }
.map-scroll { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
.map-box { width: 100%; }
.map-box svg { width: 100%; height: auto; display: block; }
.zoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.map-hint { position: absolute; left: 10px; bottom: 10px; right: 70px; font-size: 13px; font-weight: 800; background: rgba(11,34,51,.85); border-radius: 10px; padding: 6px 10px; }
.map-hint:empty { display: none; }

.toast { position: fixed; left: 16px; right: 16px; top: 64px; background: #3b1410; border: 1px solid #ff8a76; color: #ffd9d2; border-radius: 12px; padding: 12px 14px; font-weight: 800; z-index: 10; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.toast.info { background: #13324a; border-color: var(--gold); color: var(--cream); }
.offline { position: fixed; top: 0; left: 0; right: 0; background: var(--red); color: #fff; text-align: center; font-weight: 800; padding: 6px; z-index: 20; }
.winner { text-align: center; padding: 10px 0 4px; }
.winner .t { font-family: var(--title); font-size: 30px; color: var(--gold); }
.fight .js-roll { margin: 10px 0 4px; }
.fight .drow { display: flex; justify-content: center; gap: 10px; margin: 6px 0; }
.fight .drow .die3 { --s: 44px; }

/* schermata di difesa */
.defend { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(ellipse at center, rgba(120,20,15,.92), rgba(20,5,5,.96)); animation: def-in .35s ease-out; }
@keyframes def-in { from { opacity: 0; transform: scale(1.06); } to { opacity: 1; transform: none; } }
.def-box { width: 100%; max-width: 420px; text-align: center; }
.def-alert { font-family: var(--title); font-size: 30px; color: #ffd36b; letter-spacing: .08em; animation: def-pulse .8s ease-in-out infinite alternate; }
@keyframes def-pulse { from { transform: scale(1); } to { transform: scale(1.06); } }
.def-who { margin: 10px 0 18px; font-size: 17px; font-weight: 800; }
.def-vs { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 26px; }
.def-vs span { flex: 1; font-weight: 800; }
.def-vs span b { display: block; font-size: 40px; color: #ffd36b; }
.def-vs span small { display: block; color: var(--muted); font-size: 13px; }
.def-vs .x { flex: 0 0 auto; font-size: 28px; }
.def-btn { width: 100%; font-size: 30px; padding: 26px 10px; border-radius: 20px; box-shadow: 0 0 0 4px rgba(255,255,255,.25), 0 10px 30px rgba(0,0,0,.5); animation: def-pulse .6s ease-in-out infinite alternate; }
.def-title { font-size: 28px; font-weight: 900; }
.def-hint { margin-top: 12px; color: var(--muted); font-size: 14px; }
.def-bar { margin-top: 18px; height: 8px; border-radius: 6px; background: rgba(255,255,255,.15); overflow: hidden; }
.def-bar i { display: block; height: 100%; width: 100%; background: #ffd36b; transition: width .1s linear; }
.timer { display: inline-block; min-width: 28px; padding: 2px 8px; border-radius: 8px; background: var(--red); color: #fff; font-weight: 900; text-align: center; }

/* duello: pulsante "tieni premuto e rilascia" */
.hold-btn { display: block; width: 100%; margin: 14px 0 6px; font-size: 30px; padding: 24px 10px 16px; border-radius: 22px; touch-action: none; -webkit-touch-callout: none; box-shadow: 0 0 0 4px rgba(255,255,255,.22), 0 10px 30px rgba(0,0,0,.5); animation: def-pulse .7s ease-in-out infinite alternate; transition: transform .15s; }
.hold-btn small { display: block; font-size: 13px; font-weight: 800; opacity: .75; margin-top: 6px; }
.hold-btn.pressed { animation: hold-shake .12s linear infinite; transform: scale(1.06); background: #ffd84d; }
@keyframes hold-shake { 0% { transform: scale(1.06) rotate(-2deg); } 50% { transform: scale(1.06) rotate(2deg); } 100% { transform: scale(1.06) rotate(-2deg); } }
.def-box .vs { display: flex; align-items: center; justify-content: center; gap: 12px; font-weight: 900; font-size: 17px; margin: 8px 0; }
.def-box .vs .n { font-size: 34px; color: var(--gold); display: block; }
.def-box .drow, .fight .drow { display: flex; justify-content: center; gap: 10px; margin: 6px 0; }
.def-box .drow .die3 { --s: 44px; }
.def-alert { margin-bottom: 8px; }
