/* Reset minimo (senza Tailwind, per non dipendere da build) */
*, *::before, *::after { box-sizing: border-box; }
html, body, #app { min-height: 100%; }
body { margin: 0; }
button { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }

.tris-app {
  --navy: #082e73;
  --blue: #087ddd;
  --sky: #25b9f1;
  --cream: #fffaf0;
  --gold: #ffd331;
  --orange: #ff7414;
  --red: #ef2c2f;
  min-height: 100svh;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  color: #fff;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", system-ui, sans-serif;
  background:
    radial-gradient(circle at 50% 18%, rgba(111, 231, 255, .36), transparent 30rem),
    radial-gradient(circle at 50% 110%, rgba(0, 63, 174, .7), transparent 55%),
    linear-gradient(135deg, #0788df 0%, #19b9ed 48%, #0870cb 100%);
}
.tris-app::before,
.tris-app::after {
  content: "✦  ·  ○  ×  ·  ✧  ·  △  ·  ☆  ·  ×";
  position: absolute;
  z-index: -1;
  color: rgba(255, 255, 255, .16);
  font-size: clamp(1.5rem, 4vw, 4rem);
  letter-spacing: 1.5rem;
  line-height: 2.3;
  white-space: nowrap;
  pointer-events: none;
  transform: rotate(-12deg);
}
.tris-app::before { inset: 5% -8% auto; }
.tris-app::after { inset: auto -10% 8%; transform: rotate(9deg); }
.tris-decoration { position: absolute; z-index: -1; border: 2px solid rgba(255,255,255,.12); transform: rotate(28deg); pointer-events: none; }
.tris-decoration-one { width: 34rem; height: 15rem; left: -8rem; top: 15rem; border-radius: 40%; }
.tris-decoration-two { width: 25rem; height: 12rem; right: -8rem; top: 8rem; border-radius: 48%; transform: rotate(-23deg); }
.tris-dots { position: absolute; z-index: -1; width: 16rem; height: 22rem; opacity: .24; background-image: radial-gradient(#fff 2px, transparent 2px); background-size: 15px 15px; pointer-events: none; }
.tris-dots-left { left: -4rem; top: 0; transform: rotate(12deg); }
.tris-dots-right { right: -4rem; bottom: 0; transform: rotate(12deg); }
.tris-top-actions { position: absolute; z-index: 4; right: clamp(1rem, 3vw, 3rem); top: clamp(1rem, 2.5vw, 2rem); display: flex; gap: .8rem; }
.tris-icon-button { display: grid; width: clamp(3.5rem, 5.5vw, 5.1rem); height: clamp(3.5rem, 5.5vw, 5.1rem); place-items: center; color: #fff; border: 4px solid #fff; border-radius: 999px; background: linear-gradient(#249ce9, #0561b9); box-shadow: 0 5px 0 var(--navy), 0 9px 16px rgba(0, 28, 88, .35), inset 0 3px 5px rgba(255,255,255,.5); transition: transform .18s ease, filter .18s ease; }
.tris-icon-button:hover { transform: translateY(-3px) scale(1.04); filter: brightness(1.12); }
.tris-icon-button svg { width: 52%; height: 52%; stroke-width: 2.8; }
.menu-content, .game-content { position: relative; z-index: 1; width: min(94vw, 90rem); margin: auto; padding: clamp(1.4rem, 2.3vw, 2.8rem) 0 1.2rem; }
.menu-content { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; gap: clamp(.8rem, 1.4vw, 1.3rem); }
.tris-logo-wrap { text-align: center; }
.tris-logo { display: block; width: min(43vw, 38rem); max-height: clamp(7rem, 16vw, 13rem); margin: 0 auto; object-fit: contain; filter: drop-shadow(0 7px 0 rgba(5, 27, 91, .35)); }
.tris-subtitle { margin: clamp(-.7rem, -1.2vw, -.3rem) auto 0; color: var(--navy); font-size: clamp(1.15rem, 2.25vw, 2.25rem); font-weight: 900; letter-spacing: -.03em; text-shadow: 0 2px 0 rgba(255,255,255,.45); }
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(.8rem, 1.7vw, 1.7rem); margin-top: clamp(.4rem, 1vw, 1rem); }
.mode-card { position: relative; min-height: clamp(18rem, 30vw, 29rem); overflow: hidden; padding: clamp(1rem, 1.9vw, 2rem) clamp(1rem, 2.4vw, 2.6rem) 1rem; border: 5px solid #fff; border-radius: 2.1rem; text-align: center; color: #fff; box-shadow: 0 9px 0 rgba(5, 34, 112, .78), 0 17px 26px rgba(0, 34, 104, .3), inset 0 3px 10px rgba(255,255,255,.48); transition: transform .38s cubic-bezier(.22,1,.36,1), filter .38s ease, box-shadow .38s ease; will-change: transform; }
.mode-card::before { content: ""; position: absolute; inset: .6rem; border: 2px solid rgba(255,255,255,.35); border-radius: 1.5rem; pointer-events: none; }
.mode-card.is-active { filter: brightness(1.08); box-shadow: 0 9px 0 rgba(5, 34, 112, .78), 0 20px 32px rgba(0, 34, 104, .42), 0 0 0 4px rgba(255,255,255,.2), inset 0 3px 10px rgba(255,255,255,.58); }
.mode-card:hover { transform: translateY(-6px); filter: brightness(1.08); box-shadow: 0 9px 0 rgba(5, 34, 112, .78), 0 20px 32px rgba(0, 34, 104, .42), 0 0 0 4px rgba(255,255,255,.2), inset 0 3px 10px rgba(255,255,255,.58); }
.mode-card:active { transform: translateY(-2px) scale(.97); transition: transform .12s ease; }
.mode-friends { background: linear-gradient(145deg, #1683e3, #18b9ef 75%); }
.mode-computer { background: linear-gradient(145deg, #ffac19, #ff6511 78%); }
.mode-heading { position: relative; display: flex; align-items: center; justify-content: center; gap: clamp(.5rem, 1vw, 1rem); font-size: clamp(1.35rem, 2.5vw, 2.55rem); font-weight: 900; line-height: 1; text-shadow: 0 3px 0 rgba(4, 39, 104, .72); }
.mode-icon { display: grid; width: clamp(2rem, 4vw, 4rem); height: clamp(2rem, 4vw, 4rem); place-items: center; }
.mode-icon svg { width: 100%; height: 100%; fill: rgba(255,255,255,.93); stroke: var(--navy); stroke-width: 1.7; }
.mode-card p { position: relative; margin: clamp(.8rem, 1.2vw, 1.2rem) auto 0; max-width: 23rem; color: var(--navy); font-size: clamp(1rem, 1.7vw, 1.65rem); font-weight: 900; line-height: 1.12; }
.mode-preview { position: relative; display: flex; min-height: clamp(9rem, 14vw, 14rem); align-items: flex-end; justify-content: center; gap: clamp(.1rem, .7vw, .7rem); margin-top: .3rem; }
.preview-character { width: clamp(6rem, 12vw, 12rem); height: clamp(9rem, 15vw, 15rem); align-self: end; object-fit: contain; object-position: bottom; }
.preview-cpu { width: clamp(7rem, 13vw, 13rem); }
.preview-maya { width: clamp(6rem, 12vw, 12rem); }
.preview-mark { align-self: center; width: clamp(2.6rem, 5vw, 5rem); height: clamp(2.6rem, 5vw, 5rem); object-fit: contain; }
.preview-vs { align-self: center; color: #fff; font-size: clamp(1.4rem, 2.6vw, 2.6rem); font-weight: 900; text-shadow: 0 3px 0 rgba(4, 39, 104, .72); }
.preview-x { margin-right: -.2rem; }
.preview-o { margin-left: -.2rem; }
.mode-cta { position: relative; display: block; color: #fff; font-size: clamp(.8rem, 1.2vw, 1.15rem); font-weight: 900; letter-spacing: .08em; text-shadow: 0 2px 0 rgba(4,39,104,.7); }
.mode-cta span { color: var(--gold); font-size: 1.35em; }
.character-section { margin-top: clamp(.2rem, .8vw, .8rem); text-align: center; }
.character-selection-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .7rem 1.2rem; margin-bottom: clamp(.9rem, 1.6vw, 1.5rem); }
.character-section h2 { display: flex; align-items: center; justify-content: center; gap: .55rem; margin: 0; color: #fff; font-size: clamp(1.1rem, 2vw, 2rem); font-weight: 900; text-shadow: 0 3px 0 var(--navy); }
.character-section h2 svg { width: 1.1em; fill: var(--gold); stroke: #fff; }
.selection-player-tabs { display: flex; justify-content: center; gap: .45rem; }
.selection-player-tab { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .7rem; border: 2px solid rgba(255,255,255,.75); border-radius: 999px; background: rgba(4,52,130,.48); color: #fff; font-size: clamp(.62rem, .9vw, .85rem); font-weight: 900; text-shadow: 0 1px 0 var(--navy); transition: transform .16s ease, background .16s ease, filter .16s ease; }
.selection-player-tab strong { color: var(--gold); }
.selection-player-tab:hover, .selection-player-tab.is-active { transform: translateY(-2px); background: var(--navy); filter: brightness(1.2); }
.character-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(.4rem, 1.2vw, 1.2rem); margin-top: clamp(.6rem, 1.4vw, 1.2rem); }
.start-game-button { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; margin: .7rem auto 0; padding: .55rem 1.4rem; border: 3px solid #fff; border-radius: 999px; background: linear-gradient(#ffdc2f, #f28d0c); color: var(--navy); font-size: clamp(.85rem, 1.3vw, 1.2rem); font-weight: 900; box-shadow: 0 4px 0 #824400; transition: transform .16s ease, filter .16s ease; }
.start-game-button:hover { transform: translateY(-2px); filter: brightness(1.08); }
.start-game-button svg { width: 1.2em; height: 1.2em; }
.tris-copyright { margin: 1.3rem auto 0; color: rgba(255,255,255,.67); font-size: clamp(.58rem, .85vw, .78rem); font-weight: 700; text-align: center; }
.mode-heading-bar { height: .5rem; margin: .4rem auto .2rem; border-radius: 999px; width: 65%; }
.mode-heading-bar-blue { background: linear-gradient(90deg, #25b9f1, var(--navy)); }
.mode-heading-bar-orange { background: linear-gradient(90deg, #ffd331, #ff7414); }
.character-card { position: relative; min-width: 0; overflow: hidden; padding: .25rem .25rem 0; border: 4px solid #fff; border-radius: 1.45rem; background: linear-gradient(155deg, rgba(222,250,255,.92), rgba(70,180,238,.77)); box-shadow: 0 5px 0 var(--navy), 0 10px 18px rgba(0,36,116,.28), inset 0 0 0 2px rgba(10,90,173,.55); transition: transform .2s ease, filter .2s ease, box-shadow .2s ease; }
.character-card:hover, .character-card.is-selected { transform: translateY(-5px) scale(1.04); filter: brightness(1.1); box-shadow: 0 7px 0 var(--navy), 0 14px 24px rgba(0,36,116,.4), 0 0 20px rgba(255,255,255,.62); }
.character-art { position: relative; display: block; height: clamp(6.6rem, 11.4vw, 11.2rem); overflow: hidden; border-radius: 1rem 1rem .5rem .5rem; background: rgba(255,255,255,.2); }
.character-art img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: bottom; }
.character-check { position: absolute; right: .2rem; top: .2rem; display: grid; width: 1.8rem; height: 1.8rem; place-items: center; border: 2px solid #fff; border-radius: 999px; background: #18b94c; color: #fff; font-size: 1.15rem; font-weight: 900; }
.character-name { display: block; margin: .2rem auto .1rem; border: 3px solid #fff; border-radius: .7rem; color: #fff; font-size: clamp(.8rem, 1.4vw, 1.4rem); font-weight: 900; line-height: 1.5; text-shadow: 0 2px 0 rgba(0,36,116,.65); }
.character-red .character-name { background: var(--red); }
.character-teal .character-name { background: #049eae; }
.character-blue .character-name { background: #1458c9; }
.character-purple .character-name { background: #7221bf; }
.character-orange .character-name { background: #f16d13; }
.character-yellow .character-name { background: #eba916; }
.game-content { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; gap: clamp(.4rem, 1vw, 1.1rem); }
.game-layout { display: grid; grid-template-columns: minmax(9rem, 1fr) minmax(20rem, 1.45fr) minmax(9rem, 1fr); align-items: center; gap: clamp(.8rem, 2vw, 2.3rem); }
.score-panel { display: flex; min-height: clamp(27rem, 59vh, 39rem); flex-direction: column; align-items: center; justify-content: flex-start; padding: 1rem .5rem .8rem; border: 4px solid #fff; border-radius: 1.7rem; background: linear-gradient(165deg, rgba(15,145,226,.96), rgba(4,77,166,.98)); box-shadow: 0 7px 0 var(--navy), 0 12px 24px rgba(0,25,90,.32), inset 0 3px 9px rgba(255,255,255,.32); transition: filter .2s ease, box-shadow .2s ease; }
.score-panel.is-active { filter: brightness(1.15); box-shadow: 0 7px 0 var(--navy), 0 0 0 4px rgba(255,220,59,.84), 0 0 25px rgba(255,222,55,.72); }
.score-right { background: linear-gradient(165deg, rgba(15,145,226,.96), rgba(4,77,166,.98)); }
.score-label { color: #fff; font-size: clamp(1.1rem, 2vw, 2rem); font-weight: 900; text-shadow: 0 3px 0 var(--navy); }
.score-kicker { color: var(--gold); font-size: clamp(.52rem, .8vw, .78rem); font-weight: 900; text-align: center; }
.score-character { width: min(100%, 12rem); height: clamp(11rem, 24vh, 16rem); object-fit: contain; object-position: bottom; margin-top: .2rem; }
.score-cpu { width: min(100%, 13rem); }
.score-mark-wrap { display: grid; min-height: clamp(4.5rem, 8vw, 7rem); place-items: center; }
.score-mark { width: clamp(4rem, 7vw, 7rem); height: clamp(4rem, 7vw, 7rem); object-fit: contain; }
.points-box { display: flex; width: min(85%, 10rem); flex-direction: column; align-items: center; margin-top: auto; border: 4px solid var(--red); border-radius: 1rem; background: var(--cream); color: #101010; box-shadow: 0 4px 0 rgba(5,31,105,.55); }
.score-right .points-box { border-color: #1f61cf; }
.points-box span { font-size: clamp(.7rem, 1vw, 1rem); font-weight: 900; }
.points-box strong { font-size: clamp(2.3rem, 4vw, 4rem); line-height: 1; }
.board-column { min-width: 0; }
.board-frame { padding: clamp(.45rem, .8vw, .8rem); border: 5px solid #fff; border-radius: 1.8rem; background: linear-gradient(145deg, #1e2258, #090e2b); box-shadow: 0 9px 0 #05184d, 0 16px 26px rgba(0,20,70,.43), inset 0 2px 5px rgba(255,255,255,.28); }
.board-grid { display: grid; width: 100%; aspect-ratio: 1 / 1; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); overflow: hidden; border: 4px solid #11152c; border-radius: 1rem; background: #11152c; gap: 4px; }
.board-cell { display: grid; width: 100%; height: 100%; aspect-ratio: 1 / 1; min-width: 0; min-height: 0; place-items: center; padding: 0; overflow: hidden; border: 0; background: var(--cream); transition: background .16s ease, transform .16s ease; }
.board-cell:hover:not(:disabled) { background: #fff; transform: scale(.97); }
.board-cell:disabled { cursor: default; }
.board-cell.is-winning { background: #fff2a1; animation: winning-pulse 1s ease-in-out infinite alternate; }
.board-mark { display: block; width: 70%; height: auto; aspect-ratio: 1 / 1; flex: none; object-fit: contain; }
.turn-banner { display: flex; min-height: clamp(3.5rem, 6vw, 5.5rem); align-items: center; justify-content: center; gap: .8rem; margin: clamp(.6rem, 1vw, 1rem) auto 0; padding: .35rem 1.2rem; border: 4px solid #fff; border-radius: 999px; background: linear-gradient(#ffdf24, #ff9413); color: #1a1a1a; font-size: clamp(1rem, 1.8vw, 1.8rem); font-weight: 900; box-shadow: 0 5px 0 #8f4302, 0 8px 14px rgba(0,30,100,.3); }
.turn-banner strong { color: var(--red); margin-left: .25rem; }
.turn-banner img { width: clamp(2.4rem, 4vw, 4rem); height: clamp(2.4rem, 4vw, 4rem); object-fit: contain; }
.turn-banner.is-thinking { color: var(--navy); }
.thinking-dots { display: inline-flex; gap: .25rem; }
.thinking-dots i { width: .5rem; height: .5rem; border-radius: 999px; background: var(--navy); animation: dot-bounce 1s infinite; }
.thinking-dots i:nth-child(2) { animation-delay: .15s; }.thinking-dots i:nth-child(3) { animation-delay: .3s; }
.difficulty-picker { display: flex; justify-content: center; gap: .35rem; margin-top: .6rem; }
.difficulty-picker button { padding: .35rem .55rem; border: 2px solid rgba(255,255,255,.7); border-radius: 999px; background: rgba(5,45,115,.45); color: #fff; font-size: clamp(.52rem, .8vw, .75rem); font-weight: 900; }
.difficulty-picker button.is-active { background: var(--gold); color: var(--navy); }
.game-actions { display: flex; justify-content: space-between; gap: 1rem; margin-top: clamp(.2rem, .7vw, .7rem); }
.game-action { display: inline-flex; min-height: clamp(3rem, 5vw, 4.5rem); align-items: center; gap: .6rem; padding: .55rem clamp(1rem, 2.3vw, 2.5rem); border: 4px solid #fff; border-radius: 999px; color: #fff; font-size: clamp(.85rem, 1.5vw, 1.5rem); font-weight: 900; text-shadow: 0 2px 0 rgba(0,40,100,.65); box-shadow: 0 5px 0 rgba(0,31,93,.75), 0 8px 14px rgba(0,30,100,.26); transition: transform .17s ease, filter .17s ease; }
.game-action:hover { transform: translateY(-3px); filter: brightness(1.1); }.game-action svg { width: 1.25em; height: 1.25em; }
.action-new { background: linear-gradient(#59df27, #209b18); }.action-reset { background: linear-gradient(#ff9622, #ec5414); }
.tris-modal-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 1rem; background: rgba(3,23,83,.55); backdrop-filter: blur(5px); }
.tris-modal, .result-modal { position: relative; width: min(92vw, 34rem); padding: 2rem; border: 5px solid #fff; border-radius: 2rem; background: linear-gradient(145deg, #18a8eb, #095bb7); color: #fff; box-shadow: 0 8px 0 var(--navy), 0 18px 35px rgba(0,20,80,.4); text-align: center; }
.tris-modal h2, .result-modal h2 { margin: 0; font-size: clamp(1.5rem, 4vw, 2.4rem); font-weight: 900; text-shadow: 0 3px 0 var(--navy); }.tris-modal h2 { display: flex; align-items: center; justify-content: center; gap: .5rem; }.tris-modal p, .result-modal p { font-size: 1.1rem; font-weight: 700; line-height: 1.5; }.modal-close { position: absolute; right: 1rem; top: 1rem; display: grid; width: 2.5rem; height: 2.5rem; place-items: center; border: 2px solid #fff; border-radius: 50%; background: var(--red); color: #fff; }.modal-button { min-height: 3.1rem; padding: .65rem 1.3rem; border: 3px solid #fff; border-radius: 999px; background: linear-gradient(#ffdd2e, #f28b0e); color: var(--navy); font-weight: 900; box-shadow: 0 4px 0 #824400; }.modal-button.secondary { background: linear-gradient(#42c5f6, #1260c2); color: #fff; }.result-modal { overflow: hidden; }.result-trophy { width: 5rem; height: 5rem; margin: 0 auto .5rem; color: var(--gold); fill: var(--gold); stroke: #fff; }.result-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: .7rem; }.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }.confetti i { --size: .55rem; position: absolute; left: calc((var(--i) * 17%) % 100%); top: -1rem; width: var(--size); height: calc(var(--size) * 1.7); background: hsl(calc(var(--i) * 47deg), 90%, 60%); transform: rotate(calc(var(--i) * 31deg)); animation: confetti-fall 1.8s linear infinite; animation-delay: calc(var(--i) * -.12s); }
@keyframes winning-pulse { to { box-shadow: inset 0 0 0 5px var(--gold); } } @keyframes dot-bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } } @keyframes confetti-fall { to { top: 115%; transform: translateY(8rem) rotate(240deg); } }
@media (max-width: 800px) { .tris-menu-screen { overflow-y: auto; }.menu-content, .game-content { width: min(94vw, 42rem); }.mode-grid { grid-template-columns: 1fr; }.mode-card { min-height: 20rem; }.character-grid { grid-template-columns: repeat(3, 1fr); }.game-content { padding-top: 5.5rem; }.game-layout { grid-template-columns: 1fr; }.score-panel { min-height: 0; display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; padding: .5rem 1rem; }.score-label, .score-kicker { grid-column: 1 / -1; }.score-character { grid-row: 2 / span 2; width: 7rem; height: 7rem; }.score-mark-wrap { grid-column: 2; grid-row: 2; }.points-box { grid-column: 2; grid-row: 3; width: 7rem; margin-top: 0; }.board-column { order: -1; }.game-actions { padding-bottom: 1rem; } }
@media (max-width: 440px) { .character-grid { gap: .4rem; }.character-art { height: 6.2rem; }.character-name { font-size: .72rem; }.mode-preview { min-height: 8rem; }.preview-character { width: 5rem; height: 8rem; }.preview-cpu { width: 6rem; }.mode-card { border-radius: 1.4rem; }.game-actions { flex-direction: column; }.game-action { justify-content: center; }.tris-top-actions { gap: .4rem; }.tris-icon-button { width: 3rem; height: 3rem; border-width: 3px; } }
