.tetra-wrap { position: relative; display: flex; gap: 16px; justify-content: center; align-items: flex-start; padding: 22px; font-family: 'Segoe UI', sans-serif; background: linear-gradient(180deg, rgba(4,7,16,.18), rgba(4,7,16,.64)), url(/img/minigames/tetra/generated/tetra-qp-arena-bg-v1.png) center / cover no-repeat; border: 1px solid rgba(91,224,230,.18); border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.03), 0 24px 70px rgba(0,0,0,.28); overflow: hidden; }
.tetra-wrap::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(70% 70% at 50% 48%, rgba(3,6,14,.16), rgba(3,6,14,.68)); }
.tetra-wrap > * { position: relative; z-index: 1; }
.tetra-side { display: flex; flex-direction: column; gap: 8px; width: 136px; }
.tetra-right { align-items: flex-start; }
.tetra-label { font-size: 12px; font-weight: 800; letter-spacing: 1px; color: rgba(255,255,255,.55); text-transform: uppercase; }
.tetra-hold, .tetra-next { background-color: rgba(4,8,18,0.16); background-image: url(/img/minigames/tetra/generated/tetra-side-hud-atlas-v1.png); background-repeat: no-repeat; border: 1px solid rgba(91,224,230,.38); border-radius: 8px; box-shadow: 0 0 0 1px rgba(255,255,255,.04) inset, 0 14px 28px rgba(0,0,0,.34), 0 0 24px rgba(91,224,230,.12); }
.tetra-hold { background-size: 488% 472%; background-position: 7.9% 5.5%; }
.tetra-next { background-size: 535% 139%; background-position: 43.4% 6.6%; }
.tetra-next.tetra-next-h { background-size: 136% 582%; background-position: 19.6% 92.8%; }
.tetra-mid { position: relative; }
.mg-br-board .tetra-wrap { background: linear-gradient(180deg, rgba(4,7,16,.06), rgba(4,7,16,.44)), url(/img/minigames/tetra/generated/tetra-zenith-arena-bg-candidate-v1.png) center / cover no-repeat; }
.tetra-line-sprite { position: absolute; left: 50%; top: 48%; width: min(430px, 118%); aspect-ratio: 1 / 1; transform: translate(-50%, -50%); pointer-events: none; z-index: 8; background-image: url(/img/minigames/tetra/generated/tetra-lineclear-sprite-30f-ready-v1.png); background-repeat: no-repeat; background-size: 600% 500%; background-position: 0% 0%; mix-blend-mode: screen; filter: drop-shadow(0 0 26px rgba(91,224,230,.78)) drop-shadow(0 0 16px rgba(255,211,110,.24)); }
.tetra-garbage-meter { position: absolute; left: calc(var(--frame-x) - 15px); top: calc(var(--frame-top) + 5px); bottom: calc(var(--frame-bottom) + 5px); width: 12px; background: linear-gradient(180deg, rgba(143,240,245,.10), rgba(7,12,22,.72)); border: 1px solid rgba(143,240,245,.34); border-radius: 8px; overflow: hidden; z-index: 3; box-shadow: inset 0 0 12px rgba(0,0,0,.58), 0 0 16px rgba(91,224,230,.10); }
.tetra-garbage-meter:before { content:""; position:absolute; inset: 2px; border-radius: 6px; background: linear-gradient(90deg, rgba(255,255,255,.14), transparent 35%, rgba(255,255,255,.08)); pointer-events:none; z-index:2; }
.tetra-garbage-fill { position: absolute; left: 2px; right: 2px; bottom: 2px; height: 0; border-radius: 6px; background: linear-gradient(to top,#58e6d4 0%,#9df6ff 58%,#ffe28a 100%); box-shadow: 0 0 14px rgba(91,224,230,.55), inset 0 1px 0 rgba(255,255,255,.38); transition: height .12s cubic-bezier(.2,.8,.2,1); }
.tetra-garbage-hot { position: absolute; left: 2px; right: 2px; bottom: 2px; height: 0; border-radius: 6px; background: linear-gradient(to top,#ff3158,#ff8f3b 62%,#fff1ad); box-shadow: 0 0 18px rgba(255,59,92,.76), inset 0 1px 0 rgba(255,255,255,.32); transition: height .08s linear; }
.tetra-garbage-meter.danger { border-color: rgba(255,80,105,.9); box-shadow: 0 0 20px rgba(255,59,92,.62), inset 0 0 14px rgba(255,59,92,.20); animation: tetraDangerBar .45s ease-in-out infinite; }
@keyframes tetraDangerBar { 0%,100% { opacity: .82; } 50% { opacity: 1; } }
.tetra-danger { position: absolute; left: calc(var(--frame-x) - 31px); top: calc(var(--frame-top) + var(--cw)); transform: translateY(-50%); display: none; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: #ff2d2d; color: #fff; font-weight: 900; font-size: 16px; box-shadow: 0 0 14px rgba(255,45,45,.9); z-index: 6; animation: tetraDangerPulse .5s ease-in-out infinite; }
@keyframes tetraDangerPulse { 0%,100% { transform: translateY(-50%) scale(1); } 50% { transform: translateY(-50%) scale(1.25); } }
.tetra-field-frame {
  --frame-x: calc(var(--cw) * 0.16667);
  --frame-top: calc(var(--cw) * 0.4);
  --frame-bottom: calc(var(--cw) * 0.33333);
  position: relative;
  box-sizing: content-box;
  width: var(--cw);
  height: calc(var(--cw) * 2);
  padding: var(--frame-top) var(--frame-x) var(--frame-bottom);
  background: none;
  filter: drop-shadow(0 18px 36px rgba(0,0,0,.36));
}

.mg-coop-entry {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(12, 27, 43, .94), rgba(20, 13, 42, .94));
  box-shadow: inset 0 0 0 1px rgba(113, 241, 255, .18), 0 14px 34px rgba(0, 0, 0, .22);
}
.mg-coop-entry-head { display:flex; align-items:center; gap:14px; margin:0 0 14px; color:#bdf8ff; letter-spacing:.16em; font-size:13px; }
.mg-coop-entry-head span { height:1px; flex:1; background:linear-gradient(90deg, transparent, rgba(101,232,255,.48), transparent); }
.mg-coop-entry-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }

.mg-multi-grid .mg-pick.mg-pick-coop {
  min-height:168px; height:clamp(168px, 20vh, 192px); padding:18px 20px 16px;
  position:relative; overflow:hidden;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 180'%3E%3Cdefs%3E%3CradialGradient id='g' cx='76%25' cy='26%25' r='72%25'%3E%3Cstop offset='0' stop-color='%2350e5ff' stop-opacity='.28'/%3E%3Cstop offset='1' stop-color='%2350e5ff' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='g2' cx='16%25' cy='110%25' r='60%25'%3E%3Cstop offset='0' stop-color='%2357e389' stop-opacity='.16'/%3E%3Cstop offset='1' stop-color='%2357e389' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Crect width='400' height='180' fill='url(%23g)'/%3E%3Crect width='400' height='180' fill='url(%23g2)'/%3E%3Cg stroke='%237ce9ff' stroke-opacity='.08'%3E%3Cpath d='M52 0v180M104 0v180M156 0v180M208 0v180M260 0v180M312 0v180M364 0v180'/%3E%3Cpath d='M0 60h400M0 112h400'/%3E%3C/g%3E%3Cline x1='208' y1='6' x2='208' y2='174' stroke='%23a7f4ff' stroke-opacity='.32' stroke-width='2' stroke-dasharray='7 9'/%3E%3Cg fill='%23ffffff'%3E%3Ccircle cx='300' cy='52' r='2.6' opacity='.55'/%3E%3Ccircle cx='330' cy='96' r='1.8' opacity='.4'/%3E%3Ccircle cx='96' cy='128' r='2.2' opacity='.35'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(135deg, #15374a 0%, #16273f 52%, #2b1744 100%);
  background-size: cover, auto, auto;
  background-position: center;
}
.mg-multi-grid .mg-pick.mg-pick-coop2v2 {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 180'%3E%3Cdefs%3E%3CradialGradient id='c' cx='50%25' cy='42%25' r='36%25'%3E%3Cstop offset='0' stop-color='%23ffffff' stop-opacity='.3'/%3E%3Cstop offset='1' stop-color='%23ffffff' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='cl' cx='16%25' cy='40%25' r='55%25'%3E%3Cstop offset='0' stop-color='%2343d9ff' stop-opacity='.2'/%3E%3Cstop offset='1' stop-color='%2343d9ff' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='cr' cx='84%25' cy='66%25' r='55%25'%3E%3Cstop offset='0' stop-color='%23ff71c8' stop-opacity='.2'/%3E%3Cstop offset='1' stop-color='%23ff71c8' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Crect width='400' height='180' fill='url(%23cl)'/%3E%3Crect width='400' height='180' fill='url(%23cr)'/%3E%3Cg stroke='%237ce9ff' stroke-opacity='.07'%3E%3Cpath d='M52 0v180M104 0v180M156 0v180M208 0v180M260 0v180M312 0v180M364 0v180'/%3E%3Cpath d='M0 60h400M0 112h400'/%3E%3C/g%3E%3Cpath d='M226 0 174 180' stroke='%23ffffff' stroke-opacity='.26' stroke-width='2'/%3E%3Ccircle cx='200' cy='76' r='44' fill='url(%23c)'/%3E%3Cg fill='%23ffffff'%3E%3Ccircle cx='120' cy='58' r='2.4' opacity='.5'/%3E%3Ccircle cx='86' cy='112' r='1.8' opacity='.35'/%3E%3Ccircle cx='300' cy='70' r='2.4' opacity='.5'/%3E%3Ccircle cx='330' cy='124' r='1.8' opacity='.35'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(135deg, #183e52 0%, #232045 52%, #491937 100%);
}
.mg-pick-coop .mg-pick-copy { margin-left: 0; }
.mg-pick-coop40:hover { box-shadow: inset 0 0 0 1px rgba(91,224,230,.62), 0 18px 38px rgba(0,0,0,.34), 0 0 34px rgba(80,229,255,.22); }
.mg-pick-coop2v2:hover { box-shadow: inset 0 0 0 1px rgba(255,113,200,.6), 0 18px 38px rgba(0,0,0,.34), 0 0 34px rgba(255,113,200,.2); }
.mg-coop-mark {
  position:absolute; top:14px; left:16px; z-index:2;
  min-width:54px; height:54px; padding:0 10px; display:grid; place-items:center; border-radius:14px;
  color:#effeff; font-weight:1000; font-size:19px; letter-spacing:-.04em;
  background:linear-gradient(160deg, rgba(9,22,36,.88), rgba(16,32,52,.82));
  box-shadow:inset 0 0 0 1px rgba(120,245,255,.5), 0 6px 18px rgba(0,0,0,.4), 0 0 22px rgba(91,224,230,.16);
  text-shadow:0 0 14px rgba(91,224,230,.55);
}
.mg-pick-coop2v2 .mg-coop-mark { box-shadow:inset 0 0 0 1px rgba(255,140,205,.55), 0 6px 18px rgba(0,0,0,.4), 0 0 22px rgba(255,113,200,.16); text-shadow:0 0 14px rgba(255,113,200,.55); }

.mg-art-friendly {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 200'%3E%3Cdefs%3E%3CradialGradient id='f' cx='50%25' cy='40%25' r='42%25'%3E%3Cstop offset='0' stop-color='%23ffffff' stop-opacity='.36'/%3E%3Cstop offset='1' stop-color='%23ffffff' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='fl' cx='14%25' cy='44%25' r='52%25'%3E%3Cstop offset='0' stop-color='%235be0e6' stop-opacity='.18'/%3E%3Cstop offset='1' stop-color='%235be0e6' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='fr' cx='86%25' cy='44%25' r='52%25'%3E%3Cstop offset='0' stop-color='%23ffd35c' stop-opacity='.18'/%3E%3Cstop offset='1' stop-color='%23ffd35c' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Crect width='400' height='200' fill='url(%23fl)'/%3E%3Crect width='400' height='200' fill='url(%23fr)'/%3E%3Cg stroke='%237ce9ff' stroke-opacity='.07'%3E%3Cpath d='M50 0v200M100 0v200M150 0v200M200 0v200M250 0v200M300 0v200M350 0v200'/%3E%3Cpath d='M0 66h400M0 132h400'/%3E%3C/g%3E%3Ccircle cx='200' cy='84' r='52' fill='url(%23f)'/%3E%3Cpath d='M140 84h44M216 84h44' stroke='%23ffffff' stroke-opacity='.3' stroke-width='2' stroke-linecap='round'/%3E%3Cg fill='%23ffffff'%3E%3Ccircle cx='200' cy='58' r='3' opacity='.9'/%3E%3Ccircle cx='189' cy='84' r='2.2' opacity='.65'/%3E%3Ccircle cx='212' cy='90' r='2.6' opacity='.75'/%3E%3Ccircle cx='200' cy='112' r='2' opacity='.5'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(135deg, #123a44 0%, #14273f 55%, #3a2a12 100%);
  background-size: cover, auto, auto;
  background-position: center;
}
.mg-pick-friendly:hover { box-shadow: inset 0 0 0 1px rgba(255,211,92,.55), 0 18px 38px rgba(0,0,0,.34), 0 0 34px rgba(255,211,92,.18); }
.mg-friendly-search { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:18px; min-height:340px; }
.mg-friendly-search .mg-loading-txt { color:#bfe9ff; font-weight:800; letter-spacing:.04em; }
.mg-friendly-host { border-radius:16px; overflow:hidden; box-shadow:inset 0 0 0 1px rgba(91,224,230,.16); }

.mg-coop40-lb { margin-top:14px; padding:14px 16px 12px; border-radius:16px; background:linear-gradient(160deg, rgba(9,19,33,.92), rgba(14,10,30,.92)); box-shadow:inset 0 0 0 1px rgba(101,232,255,.14); }
.mg-c40lb-head { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.mg-c40lb-head b { color:#d9fbff; font-size:14px; letter-spacing:.06em; flex:1; }
.mg-c40lb-tabs { display:flex; gap:6px; }
.mg-c40lb-tab { padding:5px 16px; border-radius:8px; border:1px solid rgba(120,140,170,.25); background:rgba(12,18,32,.72); color:#8296b4; font-weight:800; font-size:12px; cursor:pointer; transition:border-color .12s, background .12s; }
.mg-c40lb-tab:hover { border-color:rgba(91,224,230,.4); }
.mg-c40lb-tab.active { border-color:rgba(91,224,230,.6); background:rgba(91,224,230,.14); color:#9ff0f5; font-weight:900; }
.mg-c40lb-row { display:flex; align-items:center; gap:12px; padding:7px 11px; border-radius:10px; }
.mg-c40lb-row + .mg-c40lb-row { margin-top:4px; }
.mg-c40lb-row.r1 { background:linear-gradient(90deg, rgba(245,197,66,.1), transparent 70%); box-shadow:inset 0 0 0 1px rgba(245,197,66,.28); }
.mg-c40lb-row.r2 { background:linear-gradient(90deg, rgba(192,203,216,.08), transparent 70%); box-shadow:inset 0 0 0 1px rgba(192,203,216,.22); }
.mg-c40lb-row.r3 { background:linear-gradient(90deg, rgba(198,131,82,.09), transparent 70%); box-shadow:inset 0 0 0 1px rgba(198,131,82,.24); }
.mg-c40lb-row.me { background:rgba(91,224,230,.1); box-shadow:inset 0 0 0 1px rgba(91,224,230,.42); }
.mg-c40lb-rank { width:30px; display:inline-flex; align-items:center; justify-content:center; color:#8296b4; font-weight:900; font-size:12px; }
.mg-c40lb-time { width:96px; color:#eaf2ff; font-size:17px; font-weight:900; font-variant-numeric:tabular-nums; text-shadow:0 0 12px rgba(91,224,230,.35); }
.mg-c40lb-names { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12.5px; }
.mg-c40lb-names b { color:#cfe0f5; font-weight:800; }
.mg-c40lb-names i { font-style:normal; color:#5c6b84; margin:0 5px; }
.mg-c40lb-msg { color:#5c6b84; font-size:12.5px; text-align:center; padding:16px 0; }
.mg-c40lb-mine-label { margin:8px 0 3px; font-size:11px; color:#7f92b0; font-weight:800; }
@media (max-width:720px) {
  .mg-coop40-lb { padding:11px 10px 9px; }
  .mg-c40lb-time { width:80px; font-size:14.5px; }
}

.mg-coop-browse-title { display:flex; align-items:baseline; gap:12px; padding:13px 20px 4px; }
.mg-coop-browse-title b { color:#d9fbff; font-size:19px; }
.mg-coop-browse-title span { color:#8ca8ba; font-size:12px; }
.mg-coop-fixed { display:flex; align-items:center; gap:14px; padding:14px 16px; margin-bottom:12px; border-radius:14px; background:rgba(91,224,230,.08); box-shadow:inset 0 0 0 1px rgba(91,224,230,.22); }
.mg-coop-fixed b { color:#9af4ff; font-size:25px; }
.mg-coop-fixed span,.mg-coop-create-note { color:#93aabd; font-size:12px; line-height:1.55; }
.mg-coop-create-note { margin-top:12px; padding:10px 12px; border-radius:10px; background:rgba(255,255,255,.035); }
@media (max-width:720px) {
  .mg-coop-entry { padding:12px; }
  .mg-coop-entry-grid { grid-template-columns:1fr; }
  .mg-multi-grid .mg-pick.mg-pick-coop { min-height:120px; height:132px; padding:14px 16px 12px; }
  .mg-coop-mark { top:10px; left:12px; min-width:44px; height:44px; font-size:15px; }
  .mg-coop-browse-title { align-items:flex-start; flex-direction:column; gap:3px; }
}
.tetra-field-frame::after { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: url(/img/minigames/tetra/generated/tetra-field-frame-clean-alpha-v1.png) center / 100% 100% no-repeat; }
.tetra-above { position: absolute; left: var(--frame-x); top: calc(var(--frame-top) - var(--cw) * .4); width: var(--cw); height: calc(var(--cw) * .4); display: block; background: transparent; border: 0; pointer-events: none; z-index: 3; }
.tetra-defeat-shutter { position: fixed; inset: 0; z-index: 12100; pointer-events: none; overflow: hidden; }
.tetra-defeat-shutter .tds-half { position: absolute; top: -2%; bottom: -2%; width: 52%; background: linear-gradient(180deg, #14171f 0%, #090b12 50%, #14171f 100%); box-shadow: inset 0 0 60px rgba(0,0,0,.7); transition: transform .3s cubic-bezier(.55,0,.35,1); will-change: transform; }
.tetra-defeat-shutter .tds-left { left: 0; transform: translateX(-101%); border-right: 3px solid rgba(255,70,86,.75); box-shadow: inset -18px 0 40px rgba(255,50,70,.18), inset 0 0 60px rgba(0,0,0,.7); }
.tetra-defeat-shutter .tds-right { right: 0; transform: translateX(101%); border-left: 3px solid rgba(255,70,86,.75); box-shadow: inset 18px 0 40px rgba(255,50,70,.18), inset 0 0 60px rgba(0,0,0,.7); }
.tetra-defeat-shutter.closing .tds-left, .tetra-defeat-shutter.closing .tds-right { transform: translateX(0); }
.tetra-defeat-shutter .tds-word { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: clamp(44px, 9vw, 120px); font-weight: 900; letter-spacing: .12em; color: #ff5a6e; opacity: 0; transform: scale(1.35); transition: opacity .26s ease, transform .26s cubic-bezier(.2,.9,.2,1); text-shadow: 0 0 34px rgba(255,60,80,.85), 0 6px 20px rgba(0,0,0,.6); }
.tetra-defeat-shutter.word-show .tds-word { opacity: 1; transform: scale(1); }
@media (prefers-reduced-motion: reduce) { .tetra-defeat-shutter .tds-half { transition: none; } }
.tetra-playfield-viewport { position: relative; width: var(--cw); height: calc(var(--cw) * 2); overflow: hidden; border-radius: 2px; background: rgba(5,10,22,.28); box-shadow: inset 0 0 0 1px rgba(91,224,230,.10); z-index: 1; }
.tetra-board { width: 100%; height: 100%; background: transparent; border: none; border-radius: 2px; display: block; position: relative; z-index: 1; }
.tetra-overlay { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(4,6,12,0.86); backdrop-filter: blur(3px); border-radius: 10px; color: #fff; text-align: center; padding: 12px; pointer-events: none; z-index: 30; }
.tetra-wrap > .tetra-overlay { z-index: 30; }
.tetra-overlay > * { pointer-events: auto; }
.tetra-big { font-size: 42px; font-weight: 900; background: linear-gradient(90deg,#ffd36e,#ff7a3c,#c06bff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tetra-retry-btn { margin-top: 10px; padding: 10px 24px; border: none; border-radius: 12px; cursor: pointer; font-weight: 800; font-size: 14px; color: #1a1024; background: linear-gradient(135deg,#ffd36e,#ff9a3c); }
.tetra-stats { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.tetra-stat-main { font-size: 30px; font-weight: 900; color: #fff; line-height: 1; }
.tetra-stat-main small { display: block; font-size: 11px; font-weight: 700; color: rgba(255,255,255,.45); letter-spacing: 1px; }
.tetra-stat-row { display: flex; justify-content: space-between; font-size: 12.5px; color: rgba(255,255,255,.6); }
.tetra-stat-row b { color: #fff; }
.tetra-badge { font-size: 12px; font-weight: 800; padding: 4px 8px; border-radius: 6px; text-align: center; }
.tetra-badge.b2b { background: linear-gradient(135deg,rgba(255,150,60,.25),rgba(255,90,45,.15)); color: #ffb86b; border: 1px solid rgba(255,150,60,.35); }
.tetra-badge.combo { background: rgba(124,92,255,.2); color: #c4b5fd; }
.tetra-badge.surge { background: linear-gradient(135deg,rgba(91,224,230,.28),rgba(160,90,255,.22)); color: #8ff0f5; border: 1px solid rgba(91,224,230,.5); font-weight: 900; letter-spacing: .5px; box-shadow: 0 0 14px rgba(91,224,230,.3); animation: tetraSurgePulse 1s ease-in-out infinite; }
@keyframes tetraSurgePulse { 0%,100% { opacity: .85; transform: scale(1); } 50% { opacity: 1; transform: scale(1.04); } }

.tetra-menu { padding: 28px 24px; text-align: center; color: #fff; background: url(/img/minigames/tetra/ui/result_panel.png) center / 100% 100% no-repeat; border-radius: 16px; max-width: 460px; margin: 0 auto; }
.tetra-menu h2 { font-size: 28px; font-weight: 900; letter-spacing: 4px; background: linear-gradient(90deg,#5be0e6,#c06bff,#ff5a6e); -webkit-background-clip: text; background-clip: text; color: transparent; margin: 0 0 4px; }
.tetra-menu .sub { color: rgba(255,255,255,.45); font-size: 12px; margin-bottom: 18px; }
.tetra-mode-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(130px,1fr)); gap: 10px; max-width: 480px; margin: 0 auto; }
.tetra-mode-btn { padding: 16px 10px; border-radius: 14px; border: 1px solid rgba(255,255,255,.1); background: linear-gradient(160deg,rgba(255,255,255,.05),rgba(255,255,255,.01)); color: #fff; font-weight: 800; cursor: pointer; transition: all .15s; }
.tetra-mode-btn:hover { transform: translateY(-2px); border-color: rgba(160,120,255,.5); }

.tetra-vs { position: relative; display: flex; gap: clamp(14px, 2vw, 26px); justify-content: center; align-items: flex-start; padding: 12px; box-sizing: border-box; max-width: 100%; overflow: visible; }
.tetra-vs #tetra-host { flex: 0 1 auto; min-width: 0; }
.tetra-vs .tetra-wrap { padding: 0; background: transparent; border: 0; box-shadow: none; overflow: visible; }
.tetra-vs .tetra-wrap::before { display: none; }
.tetra-vs-opp { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.tetra-vs-opp canvas { display: block; background: transparent; border: 0; border-radius: 2px; }
.tetra-opp-board { position: relative; }
.tetra-opp-field-frame { filter: drop-shadow(0 18px 36px rgba(0,0,0,.34)) drop-shadow(0 0 22px rgba(255,90,110,.10)); }
.tetra-opp-flash { position: absolute; inset: 0; pointer-events: none; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.tetra-oppf { position: absolute; font-size: 16px; font-weight: 900; letter-spacing: 1px; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.85), 0 0 16px currentColor; white-space: nowrap; animation: tetraOppF .85s ease-out forwards; }
@keyframes tetraOppF { 0% { opacity: 0; transform: translateY(8px) scale(.7); } 20% { opacity: 1; transform: translateY(0) scale(1.1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px) scale(.95); } }
.tetra-opp-spin-ring { position: absolute; width: 13%; aspect-ratio: 1; border: 3px solid var(--spin-col,#8ff0ff); border-radius: 50%; pointer-events: none; z-index: 9; transform: translate(-50%,-50%) scale(.35); box-shadow: 0 0 10px var(--spin-col,#8ff0ff), inset 0 0 8px var(--spin-col,#8ff0ff); animation: tetraOppSpinRing .52s cubic-bezier(.16,.72,.25,1) forwards; }
.tetra-opp-spin-ring::after { content: ''; position: absolute; inset: 26%; border-radius: 50%; background: #fff; box-shadow: 0 0 16px 8px var(--spin-col,#8ff0ff); }
@keyframes tetraOppSpinRing { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.2) rotate(0deg); } 18% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%,-50%) scale(2.7) rotate(150deg); } }
.tetra-opp-clear-burst { position: absolute; left: -4%; right: -4%; height: 7%; pointer-events: none; z-index: 8; transform: translateY(-50%) scaleX(.2); background: linear-gradient(90deg,transparent,var(--clear-col,#9bf0d4) 18%,#fff 50%,var(--clear-col,#9bf0d4) 82%,transparent); box-shadow: 0 0 18px 5px var(--clear-col,#9bf0d4); mix-blend-mode: screen; animation: tetraOppClearBurst .48s ease-out forwards; }
@keyframes tetraOppClearBurst { 0% { opacity: 0; transform: translateY(-50%) scaleX(.15); } 18% { opacity: 1; } 100% { opacity: 0; transform: translateY(-50%) scaleX(1.08); } }
.tetra-opp-surge { display: none; margin-top: 6px; padding: 4px 8px; border-radius: 6px; font-size: 12px; font-weight: 900; letter-spacing: .5px; text-align: center; color: #8ff0f5; background: linear-gradient(135deg,rgba(91,224,230,.28),rgba(160,90,255,.22)); border: 1px solid rgba(91,224,230,.5); box-shadow: 0 0 12px rgba(91,224,230,.3); animation: tetraSurgePulse 1s ease-in-out infinite; }
.tetra-opp-surge b { color: #fff; }
.tetra-opp-stats { margin-top: 6px; display: grid; grid-template-columns: auto auto; gap: 2px 10px; font-size: 11px; color: rgba(255,255,255,.55); }
.tetra-opp-stats b { color: #fff; text-align: right; font-variant-numeric: tabular-nums; }
.tetra-vs .tetra-overlay#tetra-vs-overlay { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(6,8,16,0.74); pointer-events: none; }
.tetra-vs .tetra-overlay#tetra-vs-overlay > * { pointer-events: auto; }

.tetra-toolbar { display: flex; gap: 6px; margin-top: 8px; }
.tetra-tool-btn { flex: 1; padding: 7px 0; border-radius: 9px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.04); color: #fff; font-size: 15px; cursor: pointer; transition: all .15s; }
.tetra-tool-btn:hover { background: rgba(160,120,255,.2); border-color: rgba(160,120,255,.5); }
.tetra-history-hint { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 9px; font-size: 12px; font-weight: 800; color: #9fc4d8; letter-spacing: .02em; user-select: none; }
.tetra-history-hint kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; padding: 2px 7px; border: 1px solid rgba(91,224,230,.55); border-radius: 5px; background: linear-gradient(180deg, rgba(91,224,230,.14), rgba(10,22,38,.92) 38%); color: #bfefff; font-family: inherit; font-size: 11px; font-weight: 900; box-shadow: 0 2px 0 rgba(4,10,20,.9), 0 0 10px rgba(91,224,230,.12); }
.tetra-history-hint i { font-style: normal; color: #54687f; }
.tetra-history-hint b { color: #54687f; font-weight: 700; margin: 0 4px; }

.tetra-flash { position: absolute; top: 38%; left: 50%; transform: translate(-50%,-50%); font-size: 26px; font-weight: 900; letter-spacing: 2px; color: #fff; text-shadow: 0 2px 18px rgba(0,0,0,.8), 0 0 24px currentColor; pointer-events: none; white-space: nowrap; animation: tetraFlash .85s ease-out forwards; z-index: 5; }
.tetra-flash-sub { top: 48%; font-size: 15px; letter-spacing: 1px; }
@keyframes tetraFlash {
  0% { opacity: 0; transform: translate(-50%,-30%) scale(.6); }
  18% { opacity: 1; transform: translate(-50%,-50%) scale(1.12); }
  35% { transform: translate(-50%,-50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%,-70%) scale(.96); }
}

.tetra-surge { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 30px; font-weight: 900; letter-spacing: 3px; color: #fff; pointer-events: none; z-index: 6; overflow: hidden; text-shadow: 0 0 22px #5be0e6, 0 0 40px #c06bff; }
.tetra-surge::before { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(91,224,230,.55) 48%, rgba(192,107,255,.55) 55%, transparent 68%); transform: translateX(-120%) skewX(-12deg); animation: tetraSwoosh .55s cubic-bezier(.2,.7,.2,1) forwards; }
.tetra-surge b { color: #ffd23f; }
.tetra-surge-bolt { animation: tetraBoltPulse .5s ease-out; }
@keyframes tetraSwoosh { 0% { transform: translateX(-120%) skewX(-12deg); } 100% { transform: translateX(120%) skewX(-12deg); } }
@keyframes tetraBoltPulse { 0% { transform: scale(.3); opacity: 0; } 40% { transform: scale(1.6); opacity: 1; } 100% { transform: scale(1); } }
.tetra-surge { animation: tetraSurgeFade .95s ease-out forwards; }
@keyframes tetraSurgeFade { 0% { opacity: 0; } 12% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }

.tetra-settings-ov { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(8,6,16,.9); z-index: 20; border-radius: 6px; }
.tetra-settings { width: min(420px,92%); max-height: 92%; overflow-y: auto; background: linear-gradient(165deg,#16121f,#0e0b15); border: 1px solid rgba(160,120,255,.25); border-radius: 16px; padding: 20px; color: #fff; box-shadow: 0 18px 60px rgba(0,0,0,.6); }
.tetra-set-title { font-size: 19px; font-weight: 900; letter-spacing: 2px; text-align: center; margin-bottom: 14px; background: linear-gradient(90deg,#5be0e6,#c06bff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tetra-set-sec { font-size: 11px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: rgba(160,120,255,.8); margin: 14px 0 8px; border-bottom: 1px solid rgba(255,255,255,.08); padding-bottom: 5px; }
.tetra-set-row { display: grid; grid-template-columns: 90px 1fr 38px; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 13px; color: rgba(255,255,255,.75); }
.tetra-set-row input[type=range] { width: 100%; accent-color: #c06bff; }
.tetra-set-row b { text-align: right; color: #fff; font-variant-numeric: tabular-nums; }
.tetra-key-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
.tetra-key-btn { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-radius: 9px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.04); color: rgba(255,255,255,.6); cursor: pointer; font-size: 13px; transition: all .12s; }
.tetra-key-btn em { font-style: normal; font-weight: 800; color: #fff; background: rgba(0,0,0,.3); padding: 2px 8px; border-radius: 6px; min-width: 40px; text-align: center; }
.tetra-key-btn:hover { border-color: rgba(160,120,255,.5); }
.tetra-key-btn.cap { border-color: #c06bff; background: rgba(160,120,255,.18); }
.tetra-key-btn.cap em { color: #c06bff; }
.tetra-set-btns { display: flex; gap: 10px; margin-top: 18px; }
.tetra-set-btns .tetra-retry-btn { flex: 1; margin-top: 0; }
.tetra-set-cancel { flex: 1; padding: 10px 0; border-radius: 12px; border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.05); color: #fff; font-weight: 800; cursor: pointer; }
.tetra-set-cancel:hover { background: rgba(255,255,255,.1); }

@media (max-width: 640px) {
  .tetra-wrap { gap: 8px; padding: 6px; }
  .tetra-side { width: 76px; }
  .tetra-vs { gap: 8px; }
  .tetra-flash { font-size: 18px; }
  .tetra-surge { font-size: 20px; }
}
@media (max-width: 560px) {
  .tetra-wrap { flex-direction: column; flex-wrap: nowrap; align-items: center; gap: 8px; padding: 6px; }
  .tetra-side { width: auto; max-width: 100%; }
  .tetra-left { order: 0; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
  .tetra-left .tetra-label, .tetra-right .tetra-label { display: none; }
  .tetra-left .tetra-stats { margin-top: 0; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 5px; }
  .tetra-left .tetra-stat-main { display: none; }
  .tetra-left .tetra-stat-boxes { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 4px; }
  .tetra-left .tetra-stat-boxes .tetra-stat-box { min-width: 58px; }
  .tetra-left .tetra-toolbar { margin-top: 0; }
  .tetra-mid { order: 1; }
  .tetra-right { order: 2; flex-direction: column; align-items: center; justify-content: center; gap: 6px; max-width: 100%; width: 100%; }
  .tetra-right .tetra-of { margin-top: 0; flex-direction: row; align-items: center; justify-content: center; gap: 6px; opacity: .85; }
  .tetra-right .tetra-of .tetra-of-bar { width: 8px; height: 34px; }
  .tetra-right .tetra-of-label { display: none; }
  .tetra-ended .tetra-right { display: none; }
  .tetra-end-card { padding: 16px 18px; gap: 8px; width: min(440px, 94%); }
  .tetra-end-big { font-size: 34px; }
  .tetra-end-result { font-size: 30px; }
  .tetra-rp-boxes { grid-template-columns: repeat(3, 1fr); gap: 4px; max-width: 100%; }
  .tetra-rp-boxes .tetra-stat-box { min-width: 0; padding: 4px 2px; }
  .tetra-rp-boxes .tetra-stat-box .tsb-v { font-size: 12px; }
  .tetra-rp-boxes .tetra-stat-box .tsb-l { font-size: 7.5px; }
  .tetra-left .tetra-stat-boxes .tetra-stat-box { min-width: 54px; }

  .tetra-vs { flex-direction: column; align-items: center; justify-content: flex-start; gap: 8px; padding: 6px 2px 82px; overflow: visible; }
  .tetra-vs .tetra-wrap { flex-direction: row; flex-wrap: nowrap; align-items: flex-start; justify-content: center; gap: 6px; padding: 5px; max-width: 100%; }
  .tetra-vs .tetra-left { order: 0; width: 64px; max-width: 64px; flex-direction: column; flex-wrap: nowrap; align-items: center; gap: 6px; }
  .tetra-vs .tetra-mid { order: 1; }
  .tetra-vs .tetra-right { order: 2; width: 64px; max-width: 64px; flex-direction: column; align-items: center; gap: 6px; }
  .tetra-vs .tetra-left .tetra-stats { display: none; }
  .tetra-vs .tetra-left .tetra-toolbar { width: 56px; flex-direction: column; gap: 4px; margin-top: 0; }
  .tetra-vs .tetra-tool-btn { min-height: 24px; padding: 3px 0; font-size: 12px; }
  .tetra-vs .tetra-right .tetra-of { flex-direction: column; gap: 4px; opacity: .9; }
  .tetra-vs .tetra-right .tetra-of .tetra-of-bar { width: 9px; height: 44px; }
  .tetra-vs .tetra-right .tetra-of-label { display: none; }
  .tetra-vs-opp { width: min(250px, 96vw); box-sizing: border-box; padding: 6px 8px 8px; border-radius: 0; background: transparent; border: 0; box-shadow: none; }
  .tetra-vs-opp .tetra-label { width: 100%; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tetra-opp-row { width: 100%; justify-content: center; align-items: center; gap: 7px; }
  .tetra-vs-opp .tetra-opp-field-frame { --cw: 82px !important; }
  .tetra-vs-opp .tetra-opp-board canvas { width: 82px; height: 164px; }
  .tetra-opp-side { min-width: 128px; width: 128px; gap: 5px; }
  .tetra-opp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin-top: 0; }
  .tetra-opp-stats .tetra-stat-box { padding: 4px 2px; }
  .tetra-opp-stats .tetra-stat-box .tsb-v { font-size: 11px; }
  .tetra-opp-stats .tetra-stat-box .tsb-l { font-size: 7px; }
}

@media (max-width: 720px) {
  .mg-br-board .tetra-wrap { flex-direction: row; flex-wrap: nowrap; align-items: flex-start; justify-content: center; gap: 6px; padding: 5px; max-width: 100%; }
  .mg-br-board .tetra-left { order: 0; width: 64px; max-width: 64px; flex-direction: column; flex-wrap: nowrap; align-items: center; gap: 6px; }
  .mg-br-board .tetra-mid { order: 1; }
  .mg-br-board .tetra-right { order: 2; width: 64px; max-width: 64px; flex-direction: column; align-items: center; gap: 6px; }
  .mg-br-board .tetra-left .tetra-label,
  .mg-br-board .tetra-right .tetra-label { display: none; }
  .mg-br-board .tetra-left .tetra-stats { display: none; }
  .mg-br-board .tetra-left .tetra-toolbar { width: 56px; flex-direction: column; gap: 4px; margin-top: 0; }
  .mg-br-board .tetra-tool-btn { min-height: 24px; padding: 3px 0; font-size: 12px; }
  .mg-br-board .tetra-right .tetra-of { flex-direction: column; gap: 4px; opacity: .9; }
  .mg-br-board .tetra-right .tetra-of .tetra-of-bar { width: 9px; height: 44px; }
  .mg-br-board .tetra-right .tetra-of-label { display: none; }
}

.mg-round-resetting .tetra-board,
.mg-round-resetting #tetra-oppc {
  animation: tetraBoardReset .72s cubic-bezier(.2,.85,.25,1) both;
}
.mg-round-resetting .tetra-vs::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 11;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 28%, rgba(91,224,230,.22) 45%, rgba(255,211,110,.18) 52%, transparent 70%);
  transform: translateX(-120%) skewX(-12deg);
  animation: tetraResetSweep .78s cubic-bezier(.2,.75,.2,1) both;
}
.mg-round-resetting .tetra-vs::after {
  content: 'ROUND RESET';
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 12;
  transform: translate(-50%, -50%);
  padding: 8px 16px;
  border-radius: 8px;
  background: rgba(5,9,18,.78);
  border: 1px solid rgba(91,224,230,.38);
  color: #eafcff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.5px;
  pointer-events: none;
  animation: tetraResetBadge .72s ease both;
}
@keyframes tetraBoardReset {
  0% { opacity: .22; transform: scale(.985); filter: saturate(.4) brightness(.8); }
  45% { opacity: 1; transform: scale(1.012); filter: saturate(1.25) brightness(1.2); }
  100% { opacity: 1; transform: none; filter: none; }
}
@keyframes tetraResetBadge {
  0% { opacity: 0; transform: translate(-50%, -42%) scale(.92); }
  18%, 68% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -58%) scale(.96); }
}
@keyframes tetraResetSweep {
  0% { opacity: 0; transform: translateX(-120%) skewX(-12deg); }
  18%, 72% { opacity: 1; }
  100% { opacity: 0; transform: translateX(120%) skewX(-12deg); }
}

.tetra-snd-modes { display: flex; gap: 6px; margin: 6px 0 4px; }
.tetra-snd-mode { flex: 1; padding: 8px 0; border-radius: 9px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04); color: rgba(255,255,255,.7); font-weight: 800; font-size: 12px; cursor: pointer; transition: all .12s; }
.tetra-snd-mode:hover { border-color: rgba(160,120,255,.5); }
.tetra-snd-mode.on { background: linear-gradient(135deg,#5be0e6,#c06bff); color: #1a1024; border-color: transparent; }
.tetra-uiedit-btn { width: 100%; padding: 10px 0; border-radius: 11px; border: 1px solid rgba(91,224,230,.4); background: linear-gradient(135deg,rgba(91,224,230,.18),rgba(160,90,255,.14)); color: #8ff0f5; font-weight: 900; font-size: 13px; cursor: pointer; letter-spacing: .5px; }
.tetra-uiedit-btn:hover { box-shadow: 0 0 16px rgba(91,224,230,.4); }

.tetra-editable { outline: 2px dashed rgba(91,224,230,.8); outline-offset: 3px; cursor: move; position: relative; }
.tetra-resize-h { position: absolute; right: -8px; bottom: -8px; width: 18px; height: 18px; border-radius: 5px; background: #5be0e6; border: 2px solid #0c0c14; cursor: nwse-resize; z-index: 30; box-shadow: 0 0 10px rgba(91,224,230,.8); }
.tetra-layout-bar { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 12px; background: rgba(14,11,21,.95); border: 1px solid rgba(91,224,230,.4); box-shadow: 0 8px 30px rgba(0,0,0,.6); }
.tetra-layout-bar span { font-size: 12px; font-weight: 700; color: rgba(255,255,255,.7); }
.tetra-layout-bar .tetra-retry-btn, .tetra-layout-bar .tetra-set-cancel { margin-top: 0; padding: 7px 14px; font-size: 12px; }

.tetra-opp-row { display: flex; gap: 10px; align-items: flex-start; }
.tetra-opp-side { display: flex; flex-direction: column; gap: 7px; min-width: 128px; }
.tetra-opp-side .tetra-opp-surge { margin-top: 0; }
.tetra-opp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tetra-stat-box { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 39px; background-color: rgba(5,11,24,.24); background-image: url(/img/minigames/tetra/generated/tetra-side-hud-atlas-v1.png); background-repeat: no-repeat; background-size: 757% 1280%; background-position: 3.2% 46.6%; border: 0; border-radius: 8px; padding: 6px 6px 5px; text-align: center; overflow: hidden; min-width: 0; box-shadow: 0 12px 24px rgba(0,0,0,.25), inset 0 0 0 1px rgba(255,255,255,.03); box-sizing: border-box; }
.tetra-stat-box .tsb-v { display: block; width: 100%; font-size: 14px; font-weight: 900; color: #eafcff; line-height: 1.02; font-variant-numeric: tabular-nums; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: clip; max-width: 100%; text-shadow: 0 0 8px rgba(91,224,230,.28); }
.tetra-stat-box .tsb-l { display: block; width: 100%; font-size: 8.5px; font-weight: 800; letter-spacing: 0; line-height: 1.05; color: rgba(180,220,230,.72); text-transform: uppercase; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: clip; }

.tetra-spec { display: flex; gap: 24px; justify-content: center; align-items: flex-start; padding: 16px; flex-wrap: wrap; }
.tetra-spec-p { display: flex; flex-direction: column; gap: 7px; align-items: center; }
.tetra-spec-p canvas { background: #0c0c14; border: 2px solid rgba(160,120,255,.28); border-radius: 6px; box-shadow: 0 0 28px rgba(120,60,200,.16); }
.tetra-spec-p canvas.spec-u,
.tetra-ffa-p canvas.ffa-u { background: transparent !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
.tetra-spec-p .tetra-opp-stats { grid-template-columns: 1fr 1fr; min-width: 130px; }
.tetra-spec-bot { font-size: 9px; font-weight: 900; color: #1a1024; background: linear-gradient(180deg,#8ff0f5,#5aa0d0); padding: 1px 6px; border-radius: 8px; vertical-align: middle; letter-spacing: .5px; }
@media (max-width: 480px) { .tetra-spec { gap: 10px; padding: 8px; } .tetra-spec-p .tetra-opp-stats { min-width: 0; } }

.tetra-end-card { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 11px; padding: 24px 26px; border-radius: 18px; background: linear-gradient(165deg, rgba(26,21,42,0.985), rgba(12,10,20,0.99)), url(/img/minigames/tetra/ui/result_panel.png) center / 100% 100% no-repeat; border: 1px solid rgba(160,120,255,0.42); box-shadow: 0 22px 70px rgba(0,0,0,.7), 0 0 0 1px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.06); width: min(620px, 92vw); box-sizing: border-box; animation: tetraEndIn .35s cubic-bezier(.2,.9,.25,1); }
@keyframes tetraEndIn { from { opacity: 0; transform: translateY(14px) scale(.94); } to { opacity: 1; transform: none; } }
.tetra-end-big { font-size: 46px; font-weight: 900; line-height: 1; color: #ffe9b8; text-shadow: 0 2px 4px rgba(0,0,0,.6), 0 0 22px rgba(255,170,80,.45); }
.tetra-end-sub { font-size: 12.5px; font-weight: 800; letter-spacing: 1.5px; color: #9fb4ff; text-transform: uppercase; }
.tetra-end-result { font-size: 40px; font-weight: 900; letter-spacing: 3px; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
.tetra-end-result.win { color: #5be0a0; text-shadow: 0 0 18px rgba(91,224,160,.5); }
.tetra-end-result.lose { color: #ff7a8c; text-shadow: 0 0 18px rgba(255,90,110,.4); }
.tetra-end-hint { font-size: 11px; font-weight: 800; letter-spacing: 1.5px; color: rgba(255,255,255,.4); text-transform: uppercase; }
.tetra-back-link { padding: 9px 18px; border-radius: 11px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: #fff; font-weight: 800; font-size: 13px; white-space: nowrap; flex: 0 0 auto; cursor: pointer; }
.tetra-back-link:hover { background: rgba(255,255,255,.13); }
.tetra-result-grid { display: grid; grid-template-columns: auto auto; gap: 3px 16px; align-items: center; font-size: 13px; }
.tetra-result-grid span { color: rgba(255,255,255,.55); font-weight: 700; text-align: left; }
.tetra-result-grid b { color: #fff; font-weight: 900; text-align: right; font-variant-numeric: tabular-nums; }
.tetra-result-replay { display: flex; gap: 10px; margin-top: 4px; }
.tetra-replay-view, .tetra-replay-save { padding: 9px 16px; border: none; border-radius: 11px; cursor: pointer; font-weight: 800; font-size: 13px; white-space: nowrap; flex: 0 0 auto; transition: all .15s; }
.tetra-replay-view { color: #eafcff; background: linear-gradient(135deg,rgba(91,224,230,.4),rgba(160,90,255,.32)); border: 1px solid rgba(91,224,230,.5); }
.tetra-replay-view:hover { box-shadow: 0 0 16px rgba(91,224,230,.4); transform: translateY(-1px); }
.tetra-replay-save { color: #fff; background: linear-gradient(135deg,rgba(255,255,255,.1),rgba(255,255,255,.03)); border: 1px solid rgba(255,255,255,.16); }
.tetra-replay-save:hover { background: rgba(255,255,255,.16); }
.tetra-replay-save:disabled { opacity: .6; cursor: default; color: #4fe06a; }

.tetra-replay-ov { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: rgba(6,5,12,.92); backdrop-filter: blur(4px); padding: 14px; overflow: auto; }
.tetra-replay-host { width: 100%; max-width: 560px; }

.tre-player { display: flex; flex-direction: column; align-items: stretch; gap: 14px; padding: 20px; border-radius: 18px; background: linear-gradient(165deg,rgba(28,22,42,.6),rgba(14,11,22,.5)); border: 1px solid rgba(160,120,255,.16); box-shadow: 0 20px 60px rgba(0,0,0,.55); }
.tre-stage { display: flex; justify-content: center; }
.tre-board { background: #0c0c14; border: 2px solid rgba(160,120,255,.32); border-radius: 8px; box-shadow: 0 0 44px rgba(120,60,200,.26), inset 0 0 60px rgba(0,0,0,.5); display: block; }
.tre-controls { display: flex; gap: 10px; align-items: center; width: 100%; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07); border-radius: 12px; padding: 9px 12px; }
.tre-btn, .tre-btn-loop { padding: 7px 12px; border-radius: 9px; border: 1px solid rgba(160,120,255,.4); background: rgba(160,120,255,.18); color: #fff; font-weight: 800; cursor: pointer; transition: all .15s; }
.tre-btn:hover, .tre-btn-loop:hover { background: rgba(160,120,255,.35); }
.tre-btn-loop { margin-top: 10px; width: 100%; padding: 11px; font-size: 14px; }
#tre-play { width: 46px; height: 46px; flex: 0 0 46px; padding: 0; border-radius: 50%; border: none; font-size: 18px; color: #0c0c14; background: linear-gradient(135deg,#5be0e6,#a35ddf); box-shadow: 0 4px 14px rgba(120,80,220,.45); }
#tre-play:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(120,80,220,.6); }
.tre-seek { flex: 1; accent-color: #c06bff; height: 6px; }
.tre-speed { padding: 8px 11px; border-radius: 9px; background: #16111f; color: #fff; border: 1px solid rgba(160,120,255,.3); font-weight: 800; cursor: pointer; }
.tre-rec { padding: 8px 12px; border-radius: 9px; background: #1d1016; color: #ffb3c0; border: 1px solid rgba(255,110,130,.45); font-weight: 800; font-size: 12px; cursor: pointer; white-space: nowrap; }
.tre-rec:hover { background: #2b141d; }
.tre-rec.on { background: linear-gradient(180deg, #ff5a6e, #b62b44); color: #fff; border-color: rgba(255,150,160,.8); animation: treRecPulse 1.1s ease-in-out infinite; }
.tre-rec:disabled { opacity: .45; cursor: default; }
@keyframes treRecPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,90,110,.5); } 50% { box-shadow: 0 0 0 5px rgba(255,90,110,0); } }
#tre-export-ov { position: fixed; inset: 0; z-index: 100060; display: flex; align-items: center; justify-content: center; background: rgba(3,5,12,.72); }
.tre-export-box { width: 340px; max-width: 86vw; background: linear-gradient(180deg,#101a2e,#0a101f); border: 1px solid rgba(91,224,230,.45); border-radius: 14px; padding: 22px 20px; text-align: center; box-shadow: 0 14px 50px rgba(0,0,0,.55); }
.tre-export-title { color: #dff3ff; font-weight: 900; font-size: 15px; margin-bottom: 14px; letter-spacing: .5px; }
.tre-export-bar { height: 12px; border-radius: 7px; background: #0a1220; border: 1px solid rgba(120,150,200,.3); overflow: hidden; }
.tre-export-bar i { display: block; height: 100%; width: 0%; border-radius: 7px; background: linear-gradient(90deg,#5be0e6,#7be9ff); transition: width .15s linear; }
.tre-export-pct { color: #8fa4c4; font-weight: 800; font-size: 12px; margin-top: 8px; }
.tre-export-cancel { margin-top: 14px; cursor: pointer; border: 1px solid rgba(120,150,200,.35); background: rgba(16,22,40,.9); color: #cfe8ff; border-radius: 9px; padding: 8px 18px; font-size: 12px; font-weight: 800; }
.tre-share { padding: 8px 12px; border-radius: 9px; background: #101c2b; color: #9fe8ff; border: 1px solid rgba(91,224,230,.4); font-weight: 800; font-size: 12px; cursor: pointer; white-space: nowrap; }
.tre-share:hover { background: #14283c; }

.tre-graph-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tre-graph-title { font-size: 15px; font-weight: 900; letter-spacing: .5px; background: linear-gradient(90deg,#5be0e6,#c06bff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tre-finesse-head label, .tre-graph-head label { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 800; color: rgba(255,255,255,.82); cursor: pointer; }
.tre-finesse-head input { accent-color: #ff5a6e; width: 15px; height: 15px; }
.tre-graph { display: flex; gap: 3px; align-items: flex-end; height: 100px; padding: 10px 12px; background: linear-gradient(180deg,rgba(255,255,255,.05),rgba(255,255,255,.01)); border: 1px solid rgba(255,255,255,.09); border-radius: 14px; overflow-x: auto; box-shadow: inset 0 0 26px rgba(0,0,0,.4); }
.tre-bar { flex: 0 0 11px; min-width: 11px; height: 40%; border-radius: 4px; cursor: pointer; transition: transform .1s, box-shadow .1s; }
.tre-bar:hover { transform: scaleY(1.12); filter: brightness(1.2); }
.tre-bar.ok { height: 44%; background: linear-gradient(to top,#1fb33f,#4fe06a); }
.tre-bar.fault { height: 92%; background: linear-gradient(to top,#d62f43,#ff5a6e); box-shadow: 0 0 10px rgba(255,90,110,.7); }
.tre-bar.na { height: 24%; background: rgba(255,255,255,.14); }
.tre-bar.sel { outline: 2px solid #ffd23f; outline-offset: 1px; }
.tre-graph.faults-only .tre-bar.ok, .tre-graph.faults-only .tre-bar.na { display: none; }

.tre-finesse-box { min-height: 60px; display: flex; flex-direction: column; gap: 8px; }
.tre-fin-ok { color: #4fe06a; font-weight: 800; font-size: 14px; }
.tre-fin-bad { color: #ff7a8c; font-weight: 900; font-size: 14px; }
.tre-fin-correct { color: rgba(255,255,255,.6); font-size: 12px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.tre-keys { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tre-key { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 38px; padding: 0 9px; border-radius: 9px; background: linear-gradient(160deg,#221833,#160f22); border: 1px solid rgba(160,120,255,.4); box-shadow: 0 3px 0 rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.08); color: #fff; font-weight: 900; font-size: 14px; transition: all .12s; }
.tre-key.hot { background: linear-gradient(160deg,#5be0e6,#a35ddf); border-color: #8ff0f5; box-shadow: 0 0 18px rgba(91,224,230,.7), 0 3px 0 rgba(0,0,0,.4); transform: translateY(-2px); color: #0c0c14; }
.tre-arrow { color: rgba(255,255,255,.35); font-weight: 900; }

.tre-lib { display: flex; flex-direction: column; gap: 10px; max-width: 540px; margin: 0 auto; }
.tre-lib-sec { font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: rgba(255,255,255,.5); margin-top: 6px; }
.tre-lib-list { display: flex; flex-direction: column; gap: 7px; }
.tre-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; background: linear-gradient(160deg,rgba(255,255,255,.05),rgba(255,255,255,.015)); border: 1px solid rgba(255,255,255,.08); overflow: hidden; }
.tre-row-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tre-row-info b { font-size: 15px; font-weight: 900; color: #ffd36e; }
.tre-row-info span { font-size: 11.5px; color: rgba(255,255,255,.55); font-weight: 600; }
.tre-row-act { min-width: 0; display: flex; justify-content: flex-end; gap: 6px; }
.tre-btn-play, .tre-btn-save { min-width: 38px; height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: #fff; font-size: 13px; font-weight: 800; cursor: pointer; transition: all .15s; box-sizing: border-box; }
.tre-btn-play { width: 38px; padding: 0; }
.tre-btn-save { width: auto; max-width: 150px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tre-btn-save img { width: 20px !important; height: 20px !important; flex: 0 0 20px; object-fit: contain; }
.tre-btn-play:hover { background: rgba(91,224,230,.28); border-color: rgba(91,224,230,.5); }
.tre-btn-save:hover { background: rgba(255,211,110,.25); border-color: rgba(255,211,110,.5); }
.tre-empty { padding: 14px; text-align: center; color: rgba(255,255,255,.3); }
.tre-back { margin-top: 12px; padding: 10px 24px; border: none; border-radius: 12px; cursor: pointer; font-weight: 800; font-size: 14px; color: #fff; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); align-self: center; }
.tre-back:hover { background: rgba(255,255,255,.15); }

.tetra-stat-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 4px; }
.tetra-stat-boxes .tetra-stat-box { min-width: 0; overflow: hidden; }
.tetra-stat-boxes .tetra-stat-box .tsb-v { font-size: 14px; white-space: nowrap; }
.tetra-stat-boxes .tetra-stat-box .tsb-l { font-size: 8.5px; }
@media (max-width: 640px) { .tetra-stat-boxes .tetra-stat-box .tsb-v { font-size: 12px; } }

.tetra-vs { flex-wrap: wrap; }

.tetra-rp { position: relative; z-index: 100; width: 100%; flex-basis: 100%; max-width: 760px; margin: 10px auto 0; display: flex; flex-direction: column; gap: 12px; max-height: 78vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tetra-rp-head { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 16px; background: linear-gradient(165deg,rgba(26,20,40,.95),rgba(12,10,20,.93)); border: 1px solid rgba(160,120,255,.3); box-shadow: 0 10px 40px rgba(0,0,0,.6); backdrop-filter: blur(10px); }
.tetra-rp-result { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.tetra-rp-boxes { display: grid; grid-template-columns: repeat(4,1fr); gap: 7px; width: 100%; max-width: 460px; }

.tetra-rp-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; width: 100%; }
.tetra-rp-retry, .tetra-rp-save { padding: 9px 18px; border: none; border-radius: 11px; cursor: pointer; font-weight: 800; font-size: 13px; white-space: nowrap; flex: 0 0 auto; transition: all .15s; }
.tetra-rp-retry { color: #1a1024; background: linear-gradient(135deg,#ffd36e,#ff9a3c); }
.tetra-rp-retry:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(255,150,60,.4); }
.tetra-rp-save { color: #fff; background: linear-gradient(135deg,rgba(255,255,255,.1),rgba(255,255,255,.03)); border: 1px solid rgba(255,255,255,.16); }
.tetra-rp-save:hover { background: rgba(255,255,255,.16); }
.tetra-rp-save:disabled { opacity: .7; cursor: default; color: #4fe06a; }

.tre-dock { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 16px; background: linear-gradient(165deg,rgba(22,17,34,.95),rgba(10,8,18,.93)); border: 1px solid rgba(160,120,255,.2); box-shadow: 0 16px 50px rgba(0,0,0,.6); backdrop-filter: blur(10px); }
.tre-bar-row { display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07); border-radius: 12px; padding: 9px 12px; }
.tre-play { width: 46px; height: 46px; flex: 0 0 46px; padding: 0; border-radius: 50%; border: none; font-size: 18px; color: #0c0c14; background: linear-gradient(135deg,#5be0e6,#a35ddf); box-shadow: 0 4px 14px rgba(120,80,220,.45); cursor: pointer; transition: all .15s; }
.tre-play:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(120,80,220,.6); }
.tre-play.on { background: linear-gradient(135deg,#ffd36e,#ff7a3c); }

.tre-graph { display: block; height: auto; padding: 10px 12px; overflow: hidden; }
.tre-svg { display: block; width: 100%; height: 168px; }
.tre-svg .tre-grid { stroke: rgba(255,255,255,.06); stroke-width: 1; }
.tre-svg .tre-line { stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.tre-svg .tre-area { opacity: .9; }
.tre-svg .tre-atk { opacity: .95; }
.tre-svg .tre-bar { fill: rgba(255,255,255,.14); transition: fill .12s; }
.tre-svg .tre-bar.ok { fill: #2fbf55; }
.tre-svg .tre-bar.fault { fill: #ff5a6e; filter: drop-shadow(0 0 4px rgba(255,90,110,.8)); }
.tre-svg .tre-hit { fill: transparent; cursor: pointer; }
.tre-svg .tre-hit.f:hover { fill: rgba(255,90,110,.16); }
.tre-svg .tre-hit:hover { fill: rgba(255,255,255,.05); }
.tre-svg .tre-hit.sel { fill: rgba(255,210,63,.16); stroke: #ffd23f; stroke-width: 1.5; }
.tre-svg.faults-only .tre-bar.ok, .tre-svg.faults-only .tre-bar.na { display: none; }
.tre-svg .tre-axl, .tre-svg .tre-axr { fill: rgba(255,255,255,.4); font-size: 11px; font-weight: 700; }
.tre-svg .tre-axr { text-anchor: end; }
.tre-fonly-l { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 800; color: rgba(255,255,255,.82); cursor: pointer; }
.tre-fonly-l input { accent-color: #ff5a6e; width: 15px; height: 15px; }
.tre-fonly-l b { color: #ff7a8c; }
.tre-hint { font-size: 12px; color: rgba(255,255,255,.5); text-align: center; padding: 2px 0; }

.tre-fin-na { color: rgba(255,255,255,.5); font-weight: 700; font-size: 13px; }
.tre-fin-ok b, .tre-fin-bad b { color: #fff; }
.tre-fin-show { align-self: flex-start; padding: 10px 18px; border-radius: 11px; border: 1px solid rgba(255,90,110,.5); background: linear-gradient(135deg,rgba(255,90,110,.28),rgba(160,90,255,.2)); color: #ffd9df; font-weight: 900; font-size: 13.5px; cursor: pointer; transition: all .15s; }
.tre-fin-show:hover { box-shadow: 0 0 18px rgba(255,90,110,.45); transform: translateY(-1px); }
.tre-fin-correct-head { font-size: 14px; font-weight: 900; color: #8ff0f5; letter-spacing: .3px; }
.tre-fin-correct-head small { color: rgba(255,255,255,.5); font-weight: 700; }
.tre-steps { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.tre-step { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 9px 10px; border-radius: 12px; background: linear-gradient(160deg,rgba(255,255,255,.05),rgba(255,255,255,.01)); border: 1px solid rgba(255,255,255,.08); min-width: 64px; transition: all .15s; }
.tre-step.hot { border-color: #8ff0f5; background: linear-gradient(160deg,rgba(91,224,230,.2),rgba(160,90,255,.12)); box-shadow: 0 0 16px rgba(91,224,230,.35); transform: translateY(-2px); }
.tre-step-n { width: 18px; height: 18px; border-radius: 50%; background: rgba(160,120,255,.3); color: #fff; font-size: 11px; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.tre-step .tre-key { position: relative; }
.tre-step .tre-key i { position: absolute; top: -6px; right: -6px; font-size: 11px; font-style: normal; color: #ffd23f; }
.tre-step.hot .tre-key { background: linear-gradient(160deg,#5be0e6,#a35ddf); border-color: #8ff0f5; box-shadow: 0 0 18px rgba(91,224,230,.7); color: #0c0c14; }
.tre-step-name { font-size: 11px; font-weight: 700; color: rgba(255,255,255,.62); }
.tre-fin-loop { margin-top: 4px; align-self: flex-start; padding: 9px 16px; border-radius: 10px; border: 1px solid rgba(160,120,255,.4); background: rgba(160,120,255,.18); color: #fff; font-weight: 800; font-size: 13px; cursor: pointer; }
.tre-fin-loop:hover { background: rgba(160,120,255,.35); }

.tre-exit { align-self: center; margin-top: 2px; padding: 11px 30px; border-radius: 12px; border: 1px solid rgba(255,255,255,.18); background: linear-gradient(135deg,rgba(255,90,110,.2),rgba(255,255,255,.05)); color: #fff; font-weight: 900; font-size: 14px; letter-spacing: .5px; cursor: pointer; transition: all .15s; }
.tre-exit:hover { background: linear-gradient(135deg,rgba(255,90,110,.35),rgba(255,255,255,.1)); box-shadow: 0 0 16px rgba(255,90,110,.35); }

.tre-lib-player { display: flex; flex-direction: column; gap: 14px; }
.tre-boards { display: flex; gap: 16px; justify-content: center; align-items: flex-start; flex-wrap: wrap; }
.tre-board-wrap { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.tre-bl { font-size: 12px; font-weight: 800; letter-spacing: 1px; color: rgba(255,255,255,.55); text-transform: uppercase; }
.tre-mine { background: #0c0c14; border: 2px solid rgba(160,120,255,.32); border-radius: 8px; box-shadow: 0 0 40px rgba(120,60,200,.22); }
.tre-opp { background: #0c0c14; border: 2px solid rgba(255,90,110,.3); border-radius: 8px; box-shadow: 0 0 28px rgba(214,47,67,.16); }

.tre-demo-now { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 8px 14px; border-radius: 12px; background: linear-gradient(135deg,rgba(91,224,230,.14),rgba(160,90,255,.1)); border: 1px solid rgba(91,224,230,.3); }
.tre-key.big { min-width: 50px; height: 50px; font-size: 19px; }
.tre-demo-desc { font-size: 15.5px; font-weight: 800; color: #eafcff; line-height: 1.25; }
.tre-demo-desc.dim { color: rgba(255,255,255,.5); font-weight: 700; }
.tre-demo-hint { font-size: 12px; font-weight: 700; color: rgba(143,240,245,.75); text-align: center; }

@media (max-width: 720px) {
  .tetra-rp { margin-top: 8px; max-height: 72vh; gap: 9px; }
  .tetra-rp-head { padding: 11px 12px; gap: 8px; }
  .tre-dock { padding: 12px; gap: 9px; }
  .tre-svg { height: 132px; }
  .tre-play { width: 40px; height: 40px; flex: 0 0 40px; font-size: 16px; }
  .tre-graph-title { font-size: 13px; }
  .tre-fonly-l { font-size: 12px; }
  .tre-key { min-width: 32px; height: 32px; font-size: 12px; }
  .tre-key.big { min-width: 42px; height: 42px; font-size: 16px; }
  .tre-demo-desc { font-size: 13.5px; }
  .tre-step { min-width: 44px; padding: 6px 6px; }
  .tre-exit { padding: 10px 22px; font-size: 13px; }
  .tre-boards { gap: 10px; }
}

.tetra-rp-modal { width: auto; max-width: 96vw; max-height: 95vh; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 13px; padding: 18px; border-radius: 20px; background: linear-gradient(165deg,#17131f,#0c0a14); border: 1px solid rgba(160,120,255,.3); box-shadow: 0 26px 80px rgba(0,0,0,.72); align-items: stretch; }
.tetra-rp-mhead { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.tetra-rp-modal .tre-dock { box-shadow: none; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.025); backdrop-filter: none; }
.tetra-rp-modal .tre-boards { margin: 2px 0; }
@media (max-width: 720px) {
  .tetra-rp-modal { padding: 12px; gap: 9px; border-radius: 16px; max-width: 98vw; }
}

.tetra-of { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 16px; opacity: .3; transition: opacity .25s ease; }
.tetra-of.active { opacity: 1; }
.tetra-of-bar { position: relative; width: 18px; height: 134px; border-radius: 9px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1); overflow: hidden; box-shadow: inset 0 0 8px rgba(0,0,0,.6); background-image: repeating-linear-gradient(to top, transparent 0, transparent 9px, rgba(0,0,0,.45) 9px, rgba(0,0,0,.45) 11px); }
.tetra-of.active .tetra-of-bar { box-shadow: inset 0 0 8px rgba(0,0,0,.6), 0 0 14px rgba(91,224,230,.35); }
.tetra-of-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; border-radius: 9px; transition: height .18s cubic-bezier(.2,.8,.2,1); background: linear-gradient(to top,#2bb6bd,#5be0e6); }
.tetra-of-fill::after { content: ''; position: absolute; left: -1px; right: -1px; top: -2px; height: 4px; border-radius: 4px; background: #fff; box-shadow: 0 0 10px 2px currentColor; opacity: .9; }
.tetra-of.active .tetra-of-fill { color: #5be0e6; }
.tetra-of[data-lv="2"] .tetra-of-fill { color: #ffe14d; }
.tetra-of[data-lv="3"] .tetra-of-fill { color: #ff6a4d; }
.tetra-of-num { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; color: #8ff0f5; text-shadow: 0 0 10px currentColor; line-height: 1; transition: color .2s; }
.tetra-of-label { font-size: 8.5px; font-weight: 800; letter-spacing: 2px; color: rgba(255,255,255,.4); }
.tetra-of[data-lv="1"] .tetra-of-fill { box-shadow: 0 0 10px rgba(91,224,230,.6); }
.tetra-of[data-lv="2"] .tetra-of-fill { background: linear-gradient(to top,#e0a800,#ffe14d); box-shadow: 0 0 14px rgba(255,210,60,.7); }
.tetra-of[data-lv="2"] .tetra-of-num { color: #ffe14d; }
.tetra-of[data-lv="2"] .tetra-of-bar { animation: tetraOfPulse 1s ease-in-out infinite; }
.tetra-of[data-lv="3"] .tetra-of-fill { background: linear-gradient(to top,#d62f43,#ff6a4d); box-shadow: 0 0 18px rgba(255,80,60,.85); animation: tetraOfPulse .6s ease-in-out infinite; }
.tetra-of[data-lv="3"] .tetra-of-num { color: #ff6a4d; animation: tetraOfPulse .6s ease-in-out infinite; }
@keyframes tetraOfPulse { 0%,100% { opacity: .78; } 50% { opacity: 1; } }
.tetra-of-burst { animation: tetraOfBurst .6s ease-out; }
@keyframes tetraOfBurst { 0% { transform: scale(1.35); opacity: .55; } 100% { transform: scale(1); opacity: 1; } }
.tetra-danger[data-spike="1"] { background: #ffd23f; color: #1a1208; box-shadow: 0 0 14px rgba(255,210,60,.9); animation: tetraDangerPulse .5s ease-in-out infinite; }
.tetra-danger[data-spike="2"] { background: #ff2d2d; color: #fff; box-shadow: 0 0 18px rgba(255,45,45,1); animation: tetraDangerPulse .32s ease-in-out infinite; }

.tetra-shake-s { animation: tetraShakeS .18s ease; }
.tetra-shake-m { animation: tetraShakeM .26s ease; }
.tetra-shake-l { animation: tetraShakeL .4s ease; }
@keyframes tetraShakeS { 0%,100%{transform:translate(0,0)} 25%{transform:translate(-2px,1px)} 75%{transform:translate(2px,-1px)} }
@keyframes tetraShakeM { 0%,100%{transform:translate(0,0)} 20%{transform:translate(-4px,2px)} 50%{transform:translate(3px,-2px)} 80%{transform:translate(-2px,1px)} }
@keyframes tetraShakeL { 0%,100%{transform:translate(0,0)} 15%{transform:translate(-6px,3px)} 40%{transform:translate(5px,-3px)} 65%{transform:translate(-4px,2px)} 85%{transform:translate(2px,-1px)} }
@media (prefers-reduced-motion: reduce) { .tetra-shake-s,.tetra-shake-m,.tetra-shake-l { animation: none !important; } }

.tetra-vfx-off .tetra-garbage-meter.danger,
.tetra-vfx-low .tetra-garbage-meter.danger,
.tetra-vfx-off .tetra-danger,
.tetra-vfx-low .tetra-danger,
.tetra-vfx-off .tetra-danger[data-spike="1"],
.tetra-vfx-low .tetra-danger[data-spike="1"],
.tetra-vfx-off .tetra-danger[data-spike="2"],
.tetra-vfx-low .tetra-danger[data-spike="2"],
.tetra-vfx-off .tetra-badge.surge,
.tetra-vfx-low .tetra-badge.surge,
.tetra-vfx-off .tetra-opp-surge,
.tetra-vfx-low .tetra-opp-surge,
.tetra-vfx-off .tetra-of[data-lv="2"] .tetra-of-bar,
.tetra-vfx-low .tetra-of[data-lv="2"] .tetra-of-bar,
.tetra-vfx-off .tetra-of[data-lv="3"] .tetra-of-fill,
.tetra-vfx-low .tetra-of[data-lv="3"] .tetra-of-fill,
.tetra-vfx-off .tetra-of[data-lv="3"] .tetra-of-num,
.tetra-vfx-low .tetra-of[data-lv="3"] .tetra-of-num { animation: none !important; }
.tetra-vfx-off .tetra-garbage-meter.danger,
.tetra-vfx-off .tetra-danger,
.tetra-vfx-off .tetra-danger[data-spike="1"],
.tetra-vfx-off .tetra-danger[data-spike="2"],
.tetra-vfx-off .tetra-badge.surge,
.tetra-vfx-off .tetra-opp-surge,
.tetra-vfx-off .tetra-ffa-surge { box-shadow: none !important; }

.tetra-vfx-opts { display: flex; gap: 6px; margin: 4px 0 8px; }
.tetra-vfx-opt { flex: 1; padding: 7px 4px; border-radius: 7px; border: 1px solid rgba(91,224,230,.3); background: rgba(20,26,42,.6); color: #9fb3c8; font-weight: 700; font-size: 12px; cursor: pointer; }
.tetra-vfx-opt.on { background: rgba(91,224,230,.22); border-color: #5be0e6; color: #d8fbff; }
.tetra-vfx-opt:hover { border-color: #5be0e6; }

.tetra-tool-btn.off { opacity: .4; text-decoration: line-through; }

.tsb-fault { font-size: 9px; font-weight: 800; color: #ff8a7a; vertical-align: super; margin-left: 2px; line-height: 1; }
.tetra-rp-boxes .tetra-stat-box { padding: 7px 6px; min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.tetra-rp-boxes .tetra-stat-box .tsb-v { font-size: 15px; line-height: 1.1; }
.tetra-rp-boxes .tetra-stat-box .tsb-l { font-size: 9.5px; line-height: 1.15; opacity: .68; }

.tetra-ended .tetra-overlay { position: fixed; inset: 0; z-index: 60; padding: 24px; box-sizing: border-box; }
.tetra-ended .tetra-overlay { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tetra-ended .tetra-end-card { max-height: calc(100vh - 48px); overflow-y: auto; }
@supports (height: 100dvh) { .tetra-ended .tetra-end-card { max-height: calc(100dvh - 48px); } }
@media (max-height: 700px) { .tetra-ended .tetra-overlay { align-items: flex-start; } .tetra-ended .tetra-end-card { padding: 18px 20px; gap: 8px; } }
.tetra-rp-actions { flex-wrap: nowrap; }
@media (max-width: 560px) { .tetra-rp-actions { flex-wrap: wrap; } }

@media (max-width: 560px) { .tetra-rp-boxes { grid-template-columns: repeat(3, 1fr); } }

.tetra-solo-lb { width: 100%; max-width: 420px; margin: 2px auto 2px; }
.tslb-h { font-size: 12px; font-weight: 800; color: #8ff0f5; margin-bottom: 5px; display: flex; gap: 7px; justify-content: center; align-items: center; }
.tslb-new { font-size: 10px; font-weight: 900; color: #1a1004; background: linear-gradient(180deg,#ffe48f,#f0a637); padding: 2px 8px; border-radius: 10px; box-shadow: 0 0 10px rgba(255,170,60,.5); }
.tslb-row { display: flex; align-items: center; gap: 8px; padding: 3px 10px; font-size: 12px; color: rgba(236,230,214,.82); border-radius: 5px; }
.tslb-row.me { background: rgba(91,224,230,.16); color: #eafcff; }
.tslb-row .tslb-r { width: 18px; text-align: center; color: #e8c46a; font-weight: 800; }
.tslb-row .tslb-n { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tslb-row .tslb-v { font-weight: 800; color: #8ff0f5; font-variant-numeric: tabular-nums; }
.tslb-mine { margin-top: 4px; border-top: 1px solid rgba(255,255,255,.12); padding-top: 5px; }

.tetra-ffa { display: flex; flex-direction: column; gap: 10px; align-items: center; max-height: 82vh; overflow-y: auto; padding: 6px; }
.tetra-ffa-p { display: flex; flex-direction: column; gap: 4px; align-items: center; transition: opacity .25s; }
.tetra-ffa-p canvas { background: #0c0c14; border: 2px solid rgba(91,224,230,.3); border-radius: 6px; }
.tetra-ffa-surge { display: none; position: absolute; top: 4px; right: 4px; z-index: 2; padding: 2px 5px; border-radius: 5px; font-size: 10px; line-height: 1.1; font-weight: 900; color: #ffd86b; background: rgba(20,7,12,.78); border: 1px solid rgba(255,216,107,.62); box-shadow: 0 0 10px rgba(255,120,80,.28); pointer-events: none; font-variant-numeric: tabular-nums; }
.tetra-ffa-surge b { color: #fff; }
.tetra-ffa-p.tetra-ffa-ko { opacity: .35; }
.tetra-ffa-p.tetra-ffa-ko canvas { border-color: rgba(255,74,90,.5); }
.tetra-ffa-no { display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 5px; background: rgba(255,210,63,.2); border: 1px solid rgba(255,210,63,.6); color: #ffe9a8; font-size: 11px; font-weight: 800; }
.tetra-ffa-place { position: absolute; top: 12%; left: 50%; transform: translateX(-50%); z-index: 12; font-size: 44px; font-weight: 900; color: #ffe9a8; text-shadow: 0 0 18px rgba(255,210,63,.65), 0 2px 8px rgba(0,0,0,.7); pointer-events: none; }
.tetra-ffa-p.tetra-ffa-ally canvas { border-color: rgba(112,240,107,.55); box-shadow: 0 0 14px rgba(112,240,107,.2); }
.tetra-goal-timer { position: fixed; top: 52px; left: 50%; transform: translateX(-50%); z-index: 57; font-size: 18px; font-weight: 900; color: #d8fff6; background: rgba(6,10,20,.85); border: 1px solid rgba(91,224,230,.4); border-radius: 10px; padding: 4px 14px; pointer-events: none; font-variant-numeric: tabular-nums; }
.tetra-goal-timer.tetra-goal-urgent { color: #ffb3bd; border-color: rgba(255,90,110,.6); animation: tgtUrgent .5s ease-in-out infinite; }
@keyframes tgtUrgent { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

.tre-lib-tabs { display: flex; gap: 8px; }
.tre-lib-tab { flex: 1 1 0; padding: 9px 10px; border-radius: 9px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.04); color: #9fb0c8; font-weight: 800; font-size: 13px; cursor: pointer; }
.tre-lib-tab.on { background: rgba(91,224,230,.14); border-color: rgba(91,224,230,.5); color: #dff6f8; }
.tre-lib-tab i { font-style: normal; font-size: 11px; color: rgba(255,255,255,.45); margin-left: 4px; }
.tre-lib-scroll { max-height: min(46vh, 430px); overflow-y: auto; padding: 10px; border-radius: 12px; background: rgba(4,8,18,.55); border: 1px solid rgba(255,255,255,.07); scrollbar-width: thin; scrollbar-color: rgba(91,224,230,.4) transparent; }
.tre-lib-scroll::-webkit-scrollbar { width: 8px; }
.tre-lib-scroll::-webkit-scrollbar-thumb { background: rgba(91,224,230,.35); border-radius: 4px; }
.tre-row-meta { display: block; font-size: 11px; color: rgba(160,178,204,.65); margin-top: 2px; }

.tre-dual-ov { position: fixed; inset: 0; z-index: 100006; display: flex; align-items: center; justify-content: center; background: rgba(4,5,12,.94); backdrop-filter: blur(4px); padding: 14px; overflow: auto; }
.tre-dual { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 96vw; }
.tre-dual-title { font-size: 15px; font-weight: 900; letter-spacing: 3px; color: #e8c46a; }
.tre-dual-boards { display: flex; align-items: flex-start; gap: 22px; }
.tre-dual-vs { align-self: center; font-size: 22px; font-weight: 900; color: #e8c46a; letter-spacing: 2px; text-shadow: 0 0 14px rgba(232,196,106,.5); }
.tre-dl-tag { font-style: normal; font-size: 11px; font-weight: 900; border-radius: 4px; padding: 1px 7px; margin-left: 6px; letter-spacing: 1px; }
.tre-dl-tag.w { background: rgba(88,224,122,.16); color: #58e07a; border: 1px solid rgba(88,224,122,.4); }
.tre-dl-tag.l { background: rgba(255,90,110,.14); color: #ff8a95; border: 1px solid rgba(255,90,110,.35); }
.tre-dl-time { font-size: 12px; font-weight: 800; color: #9fb0c8; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tre-dual .tre-bar-row { width: min(560px, 92vw); }
@media (max-width: 720px) { .tre-dual-boards { gap: 10px; } .tre-dual-vs { font-size: 15px; } }

.tetra-touch-controls { display: none; }
@media (hover: none) and (pointer: coarse) {
  #minigame-modal.tetra-touch-active #mg-root { box-sizing: border-box; padding-bottom: calc(126px + env(safe-area-inset-bottom)); }
  #minigame-modal.tetra-touch-active #mg-tetra-pixi { bottom: calc(126px + env(safe-area-inset-bottom)) !important; }
  .tetra-touch-controls { position: fixed; left: 0; right: 0; bottom: 0; z-index: 100070; min-height: 126px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 18px; background: linear-gradient(0deg,rgba(4,8,18,.98),rgba(5,12,24,.9) 72%,rgba(5,12,24,.25)); border-top: 1px solid rgba(91,224,230,.2); touch-action: none; user-select: none; -webkit-user-select: none; }
  .ttc-group { display: grid; gap: 7px; flex: 0 1 auto; }
  .ttc-move { grid-template-columns: repeat(3,minmax(42px,58px)); align-items: end; }
  .ttc-action { grid-template-columns: repeat(3,minmax(40px,54px)); }
  .tetra-touch-controls button { min-width: 42px; height: 48px; padding: 0 6px; border-radius: 12px; border: 1px solid rgba(143,240,245,.26); background: linear-gradient(180deg,rgba(27,44,68,.96),rgba(10,20,36,.98)); color: #eafcff; box-shadow: inset 0 1px 0 rgba(255,255,255,.08),0 5px 14px rgba(0,0,0,.34); font: 900 12px/1 system-ui,sans-serif; touch-action: none; -webkit-tap-highlight-color: transparent; }
  .tetra-touch-controls button span { pointer-events: none; }
  .tetra-touch-controls button.pressed { transform: translateY(2px) scale(.96); border-color: #7be9ff; background: linear-gradient(180deg,rgba(53,112,142,.98),rgba(16,54,76,.98)); box-shadow: inset 0 0 14px rgba(91,224,230,.28),0 0 18px rgba(91,224,230,.2); }
  .ttc-move button { height: 56px; font-size: 24px; }
  .ttc-action .ttc-hard { grid-column: span 2; color: #fff1c4; border-color: rgba(255,190,80,.42); background: linear-gradient(180deg,rgba(105,64,18,.98),rgba(48,30,12,.98)); }
  .tetra-history-btn span { display: none; }
}
@media (max-width: 380px) {
  .tetra-touch-controls { gap: 8px; padding-left: 6px; padding-right: 6px; }
  .ttc-group { gap: 5px; }
  .ttc-move { grid-template-columns: repeat(3,42px); }
  .ttc-action { grid-template-columns: repeat(3,40px); }
  .tetra-touch-controls button { min-width: 38px; height: 46px; padding: 0 3px; font-size: 10px; }
}

.tetra-rp-exit { padding: 9px 18px; border-radius: 11px; cursor: pointer; font-weight: 800; font-size: 13px; white-space: nowrap; flex: 0 0 auto; transition: all .15s; color: #ffb3c0; background: rgba(40, 14, 22, 0.75); border: 1px solid rgba(255, 110, 130, 0.45); }
.tetra-rp-exit:hover { transform: translateY(-1px); background: rgba(60, 18, 28, 0.9); box-shadow: 0 0 14px rgba(255, 110, 130, 0.3); }

.tetra-focus-warn { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); z-index: 100030; cursor: pointer; animation: tfwIn .32s cubic-bezier(.2,1.5,.4,1); }
.tfw-box { display: flex; align-items: center; gap: 13px; padding: 13px 22px 13px 16px; border-radius: 14px; border: 1.5px solid rgba(232,196,106,.65); background: linear-gradient(180deg, rgba(34,26,10,.94), rgba(14,11,5,.96)); box-shadow: 0 10px 40px rgba(0,0,0,.55), 0 0 22px rgba(232,196,106,.18), inset 0 1px 0 rgba(255,255,255,.08); backdrop-filter: blur(8px); }
.tfw-ic { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 11px; background: rgba(232,196,106,.12); border: 1px solid rgba(232,196,106,.35); animation: tfwPulse 1.1s ease-in-out infinite; }
.tfw-t { font-size: 15px; font-weight: 900; letter-spacing: .03em; background: linear-gradient(180deg, #fff4d4, #e8c46a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tfw-d { margin-top: 3px; font-size: 12px; font-weight: 600; color: #b9c6d8; }
@keyframes tfwIn { 0% { transform: translateX(-50%) translateY(-18px); opacity: 0; } 100% { transform: translateX(-50%) translateY(0); opacity: 1; } }
@keyframes tfwPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(232,196,106,.35); } 50% { box-shadow: 0 0 0 9px rgba(232,196,106,0); } }

.tetra-lethal-warn { position: fixed; transform: translateX(-50%); z-index: 100026; pointer-events: none; animation: tlwIn .3s cubic-bezier(.2,1.8,.4,1); filter: drop-shadow(0 0 10px rgba(255,45,77,.85)) drop-shadow(0 0 26px rgba(255,45,77,.45)); }
.tetra-lethal-warn svg { animation: tlwPulse .42s ease-in-out infinite alternate; }
.tetra-lethal-warn.out { animation: tlwOut .32s ease forwards; }
@keyframes tlwIn { 0% { transform: translateX(-50%) scale(.2); opacity: 0; } 60% { transform: translateX(-50%) scale(1.25); opacity: 1; } 100% { transform: translateX(-50%) scale(1); } }
@keyframes tlwPulse { 0% { transform: scale(1); filter: brightness(1); } 100% { transform: scale(1.18); filter: brightness(1.6); } }
@keyframes tlwOut { 0% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%) scale(.6); } }
