/* Keep the shared table, hand and actions within one viewport. */
[hidden]{display:none!important}
.home-tabs{display:none}
.welcome{margin:16px auto;max-width:1120px}.welcome-title{margin-bottom:18px}.welcome-title h1{font-size:30px}
.entrance{padding:22px}.entrance>p{margin:8px 0 14px}.field{margin-bottom:14px}.choices{margin:14px 0}.choice{padding:12px}
.field-grid{gap:10px 16px}.field-grid .field{margin-bottom:4px}.practice-line{margin-top:16px;padding-top:12px}
.in-room .brand-note,.in-room .brand .logo{display:none}.in-room .topbar{height:46px}
.lobby{margin:12px auto}.lobby-head{margin-bottom:14px}.lobby-panel{padding:18px}.lobby-panel .field{margin-bottom:10px}.lobby-panel h2{margin-bottom:12px}
.lobby-panel:last-child{display:grid;grid-template-columns:1fr 1fr;gap:8px 14px;align-content:start}.lobby-panel:last-child>h2,.lobby-panel:last-child>.quiet-note,.lobby-panel:last-child>#save-settings{grid-column:1/-1}
.lobby-footer{margin-top:14px}.seat-row{padding:10px 0}
.form-error:empty{display:none}
.in-game .table .player{padding:3px 4px;line-height:1.2}.in-game .table .player .avatar{width:24px;height:24px;font-size:12px}
@media(min-width:801px){body:not(.in-game) .topbar{height:54px}body:not(.in-game) #root{padding:12px 28px}.welcome{margin:0 auto}.welcome-title .eyebrow{display:none}.welcome-title{margin-bottom:12px;align-items:center}.welcome-title h1{font-size:24px;margin:0 0 4px}.welcome-title p{margin:0}.entrance{padding:18px}.entrance h2{margin:0 0 6px}.entrance>p{margin:5px 0 10px}.field-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.field input,.field select{padding:9px 10px;margin-top:5px}.field{margin-bottom:10px}.choices{margin:10px 0}.practice-line{margin-top:10px;padding-top:8px}}
.in-game{height:100dvh;overflow:hidden}.in-game>.topbar{display:none}
.in-game #root{height:100dvh;width:100%;max-width:1800px;margin:0 auto;padding:10px 20px max(10px,env(safe-area-inset-bottom));display:grid;grid-template-rows:auto auto clamp(120px,20dvh,190px) auto auto minmax(140px,1fr) auto;gap:6px;overflow:hidden}
.in-game .game-header{margin:0;min-height:32px;align-items:center}.in-game .game-title{gap:8px;align-items:center}.in-game .game-title h1{font-size:16px;display:inline;margin-right:10px}.in-game .game-title>div{display:flex;align-items:center}.in-game .mode-chip{width:28px;height:28px;font-size:16px}.in-game .game-controls{display:flex;flex-wrap:nowrap;gap:3px}.in-game .game-controls button{padding:6px 8px;white-space:nowrap}
.game-notices:empty{display:none}.game-notices .error-banner,.game-notices .pending-note{margin:0;padding:4px 10px}
.in-game .game-header{grid-row:1}.in-game .game-notices{grid-row:2}.in-game .table{grid-row:3}.in-game .turn-ribbon{grid-row:4}.in-game .hand-head{grid-row:5}.in-game #hand{grid-row:6}.in-game #composer{grid-row:7}
.in-game .table{min-height:0;padding:10px 14px 6px;border-radius:18px;display:grid;grid-template-columns:145px minmax(0,1fr) 145px;grid-template-rows:repeat(3,minmax(0,1fr)) auto;gap:3px 14px;overflow:hidden}
.in-game .table:before{border-radius:12px;inset:6px}.in-game .players{display:contents}.in-game .player{grid-row:var(--seat-row);grid-column:var(--seat-column);min-width:0;align-self:center;padding:7px 8px;gap:8px;margin:0}.in-game .player-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:90px}.in-game .player .avatar{width:30px;height:30px;border-radius:8px;font-size:14px}.in-game .opponent-backs{display:none}
.in-game .play-field{grid-column:2;grid-row:1/4;min-height:0;padding:5px;overflow:auto;gap:12px}.in-game .table-bottom{grid-column:1/-1;grid-row:4;padding:4px 4px 0;font-size:10px}.in-game .played{min-width:160px;padding:10px 18px;border-radius:12px}.in-game .played-formula{font-size:32px}.in-game .played-name{margin:2px 0}.in-game .played-atom-cards{display:none}.in-game .played-meta,.in-game .turn-caption{font-size:11px;margin:4px 0}.in-game .center-empty h2{font-size:24px;margin:6px 0}.in-game .center-empty p{font-size:12px;margin:4px 0}.in-game .context-atoms{gap:5px}.in-game .context-atom{padding:6px;font-size:22px}.in-game .draw-pile{flex-shrink:0;transform:scale(.8);margin:-8px}
.in-game .turn-ribbon{margin:0;padding:5px 12px;min-width:0;gap:8px;flex-wrap:nowrap}.in-game .turn-ribbon>span{font-size:11px}.in-game .hand-head{margin:0;align-items:center}.in-game .hand-head h2{font-size:14px}.in-game .hand-tools{flex-wrap:nowrap}.in-game .hand-tools .quiet{padding:4px 8px}
.in-game #hand.physical-hand{height:100%!important;max-height:none;min-height:0;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;border-radius:10px;background:linear-gradient(#f3f6f500,#eaf0ed99)}
.in-game #hand:after{display:none}.in-game .composer{position:relative;bottom:auto;margin:0;padding:9px 12px;border-radius:12px;min-width:0;box-shadow:0 2px 10px #193e3010}.in-game .composer-top{flex-direction:row;align-items:center;gap:10px}.in-game .selection-text{font-size:13px;min-width:0;flex:1}.in-game .selection-text small{font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;max-width:65vw}.in-game .composer-actions{flex-shrink:0;gap:6px}.in-game .composer-actions .btn{padding:9px 16px}.in-game .composer>.quiet-note{margin:3px 0;font-size:10px}
.in-game .candidate-list{display:flex;flex-wrap:nowrap;overflow:auto;max-height:85px;gap:8px;margin:6px 0 0;padding:2px}.in-game .candidate-list .match{flex:0 0 auto;padding:6px 10px;min-width:90px}.in-game .candidate-list .match strong{font-size:16px}.in-game .candidate-list .match span,.in-game .candidate-list .match small{font-size:10px}
@media(max-width:800px){
 .home-tabs{display:flex;gap:8px;margin:10px 0}.home-tabs .btn{flex:1;padding:9px}.welcome:not(.show-join) .entrance:last-child,.welcome.show-join .entrance:first-child{display:none}.welcome .entrance>h2,.welcome .entrance>p:not(.form-error){display:none}.welcome .practice-line{margin-top:8px}.welcome .field{margin-bottom:8px}
 .welcome{margin:8px auto}.welcome-title{margin-bottom:12px}.welcome-title .eyebrow,.welcome-title .edition{display:none}.welcome-title h1{font-size:24px}.welcome-title p{font-size:12px}.entrance{padding:16px}.entrance h2{font-size:19px}.entrance>p{font-size:12px}.field-grid{grid-template-columns:1fr 1fr}.field{font-size:12px}.field input,.field select{padding:9px;min-height:40px;font-size:12px}.choice{padding:10px}.choice strong{font-size:14px}.choice span{font-size:11px}.deck-marks{font-size:10px}
 .in-game #root{padding:5px 8px max(5px,env(safe-area-inset-bottom));gap:4px;grid-template-rows:auto auto clamp(120px,20dvh,170px) auto auto minmax(140px,1fr) auto}
 .in-game .game-title h1{display:none}.in-game .game-title .room-label{font-size:10px}.in-game .game-controls{gap:0}.in-game .game-controls button{padding:7px 5px;font-size:11px}.in-game .mode-chip{display:none}
 .in-game .table{grid-template-columns:72px minmax(0,1fr) 72px;gap:2px 3px;padding:7px 5px 5px}.in-game .player{padding:5px 3px;gap:2px;display:block}.in-game .player .avatar{display:none}.in-game .player-name{max-width:66px;font-size:11px}.in-game .player-cards{font-size:10px}.in-game .table-bottom{font-size:9px;gap:4px}.in-game .play-field{padding:2px;gap:2px;flex-wrap:wrap;align-content:center}.in-game .played{min-width:0;padding:8px;max-width:100%}.in-game .played-formula{font-size:25px;overflow-wrap:anywhere}.in-game .played-name{font-size:12px}.in-game .center-empty h2{font-size:18px}.in-game .center-empty p,.in-game .center-empty .eyebrow{display:none}.in-game .turn-caption{font-size:10px}.in-game .context-atom{font-size:18px;padding:4px}.in-game .draw-pile{width:42px;height:54px;transform:none;margin:0}.in-game .draw-pile>span{font-size:20px}.in-game .draw-pile small{font-size:9px}
 .in-game .turn-ribbon{padding:5px 8px}.in-game .turn-ribbon strong{font-size:12px}.in-game .turn-ribbon>span{display:none}.in-game .hand-tools label{font-size:0}.in-game .hand-tools select{font-size:11px;max-width:100px}.in-game .hand-head h2{font-size:12px}.in-game .hand-tools .quiet{font-size:11px;padding:5px}.in-game .composer{padding:7px 9px}.in-game .composer-top{flex-wrap:wrap;gap:5px}.in-game .selection-text{flex-basis:100%;font-size:12px}.in-game .selection-text small{display:none}.in-game .composer-actions{width:100%;justify-content:flex-end}.in-game .composer-actions .btn{min-height:40px;padding:8px 15px}.in-game .composer-actions #play{flex:1}.in-game .candidate-list{max-height:76px}
}

@media(orientation:landscape) and (max-height:540px){
 .in-game #root{grid-template-columns:minmax(270px,1fr) minmax(360px,1.35fr);grid-template-rows:30px minmax(0,1fr);gap:4px 12px;}
 .in-game .game-header{grid-column:1/-1;grid-row:1;}
 .in-game .table{grid-column:1;grid-row:2;min-width:0;width:auto;}
 .in-game .hand-bar{grid-column:2;grid-row:2;align-self:start;}
 .in-game #hand{grid-column:2;grid-row:2;align-self:stretch;margin-top:48px;}
}

/* The game view is a fixed viewport. Only the hand itself may scroll. */
.in-game #root{grid-template-rows:auto auto minmax(120px,20dvh) auto minmax(0,1fr);}
.in-game .game-header{grid-row:1}.in-game .game-notices{grid-row:2}.in-game .table{grid-row:3}.in-game .hand-bar{grid-row:4}.in-game #hand{grid-row:5;}
.in-game .table{overflow:hidden;min-height:0;}
.in-game .play-field{overflow:hidden;min-height:0;}
.in-game .hand-bar{min-width:0;margin:0;}
.in-game #hand{min-height:0;max-height:100%;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;}
.in-game .hand-actions{animation:none;gap:5px;min-width:0;}
.in-game .hand-actions button{white-space:nowrap;}
@media(orientation:landscape) and (max-height:540px){
 .in-game #root{grid-template-columns:minmax(0,1fr) minmax(260px,1.2fr);grid-template-rows:30px auto 30px minmax(0,1fr) auto;gap:4px 12px;padding:4px max(10px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left))}
 .in-game .game-header{grid-column:1/-1;grid-row:1}.in-game .game-notices{grid-column:1/-1;grid-row:2}.in-game .table{grid-column:1;grid-row:3/6;grid-template-columns:65px minmax(0,1fr) 65px;padding:6px;gap:2px}.in-game .hand-head{grid-column:2;grid-row:3}.in-game #hand{grid-column:2;grid-row:4}.in-game #composer{grid-column:2;grid-row:5}.in-game .turn-ribbon{position:absolute;left:10px;top:36px;z-index:2;max-width:42%;padding:3px 6px;font-size:10px}.in-game .turn-ribbon>span{display:none}.in-game .table .player{display:block;padding:4px 2px}.in-game .table .avatar{display:none}.in-game .player-name{max-width:60px;font-size:10px}.in-game .player-cards{font-size:9px}.in-game .table .play-field{padding-top:18px}.in-game .table-bottom{font-size:9px}.in-game .composer-actions .btn{min-height:34px;padding:5px 12px}.in-game .composer .selection-text small{display:none}.in-game .candidate-list{max-height:65px}.in-game .played{min-width:0;padding:8px}.in-game .played-formula{font-size:24px}.in-game .center-empty h2{font-size:18px}.in-game .center-empty p{display:none}
}

@media(max-width:800px){
 .in-game #root{grid-template-rows:auto auto clamp(120px,20dvh,170px) auto minmax(0,1fr);gap:4px;}
 .in-game .hand-bar{padding:6px 8px;}
 .in-game .hand-bar-row{gap:6px;}
 .in-game .hand-status{gap:5px;min-width:0;}
 .in-game .turn-timer{display:none;}
 .in-game .turn-status{font-size:11px;overflow:hidden;text-overflow:ellipsis;max-width:7.5em;}
 .in-game .hand-count{font-size:10px;}
 .in-game .hand-selection{font-size:11px;}
 .in-game .hand-selection{display:none;}
 .in-game .hand-actions{gap:2px;}
 .in-game .hand-actions .quiet,.in-game .hand-actions .btn{font-size:9px;padding:5px 4px;}
 .in-game #hand{max-height:100%;}
}
/* Unified hand toolbar: reserve room for played formulae and card edges. */
.in-game #root{grid-template-rows:auto auto minmax(205px,.8fr) auto minmax(180px,1.2fr)}
.in-game .play-field{overflow:hidden;align-content:center;min-width:0}
.in-game .play-field>div{max-width:100%;min-width:0}
.in-game .played{max-width:100%;box-sizing:border-box}
.in-game .played-formula{overflow-wrap:anywhere;line-height:1.15}
.in-game .hand-bar{padding:8px 10px;background:#fff;border:1px solid #dce6e3;border-radius:10px}
.in-game .hand-bar-row{display:flex;align-items:center;flex-wrap:wrap;gap:6px 12px}
.in-game .hand-status{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.in-game .hand-selection{flex:1;min-width:100px;font-size:12px}
.in-game .hand-actions{display:flex;align-items:center;margin-left:auto;gap:6px}
.in-game .hand-actions button{min-height:36px;padding:7px 12px}
.in-game #hand{margin-top:0;align-self:stretch}
@media(max-width:800px){
 .in-game #root{grid-template-rows:auto auto minmax(190px,.7fr) auto minmax(150px,1.3fr)}
 .in-game .hand-status{width:100%;justify-content:space-between;gap:4px}
 .in-game .turn-status{max-width:none;font-size:12px}
 .in-game .turn-timer{display:inline-block;font-size:10px;padding:3px}
 .in-game .hand-selection{display:block;flex-basis:100%;font-size:11px;min-width:0}
 .in-game .hand-selection:empty{display:none}
 .in-game .hand-actions{width:100%;gap:5px}
 .in-game .hand-actions .quiet,.in-game .hand-actions .btn{font-size:12px;padding:7px 9px;min-height:38px}
 .in-game .hand-actions #play{flex:1}
 .in-game .hand-count{font-size:12px}
 .in-game .played-formula{font-size:23px}
 .in-game .play-field .turn-caption{line-height:1.2}
}
@media(orientation:landscape) and (max-height:540px){
 .in-game #root{grid-template-columns:minmax(0,1fr) minmax(0,1.25fr);grid-template-rows:30px auto auto minmax(0,1fr);gap:5px 10px}
 .in-game .game-header{grid-row:1;grid-column:1/-1}
 .in-game .game-notices{grid-row:2;grid-column:1/-1}
 .in-game .table{grid-column:1;grid-row:3/5;min-height:0}
 .in-game .hand-bar{grid-column:2;grid-row:3;align-self:stretch;padding:5px 7px}
 .in-game #hand{grid-column:2;grid-row:4;margin-top:0;height:100%!important}
 .in-game .hand-status{width:auto;flex:1}
 .in-game .hand-selection{display:none}
 .in-game .hand-actions{width:auto;flex-wrap:nowrap}
 .in-game .hand-actions .quiet,.in-game .hand-actions .btn{min-height:34px;padding:5px 7px;font-size:11px}
 .in-game .table .play-field{padding-top:3px}
 .in-game .candidate-list{max-height:62px}
}
/* Preserve the original fan; reserve separate vertical bands for every card label. */
.physical-hand .card-center{inset:47px 5px 8px;justify-content:flex-start;gap:2px}
.physical-hand .card-center strong{font:39px/39px Georgia,serif}
.physical-hand .card-center span{font:11px/15px sans-serif;margin:0}
.physical-hand .card-center small{font:10px/13px ui-monospace,monospace}
.compact-cards .card-corner{left:6px;top:5px;line-height:1}
.compact-cards .card-corner b{display:block;font:600 17px/20px Georgia,serif}
.compact-cards .card-corner small{font:9px/11px ui-monospace,monospace}
.compact-cards .card-center{inset:42px 4px 3px;gap:3px}
.compact-cards .card-center strong{font:23px/24px Georgia,serif}
.compact-cards .card-center span{font:10px/12px sans-serif;margin:0}
.compact-cards .card-center small{font:9px/11px ui-monospace,monospace}
@media(max-width:800px){
 .in-game .hand-bar-row{gap:8px}
 .in-game .hand-status{display:grid;grid-template-columns:1fr auto auto;gap:8px}
 .in-game .hand-selection .gesture-hint{display:none}
 .in-game .hand-selection:has(.gesture-hint){display:none}
 .in-game .hand-actions{display:grid;grid-template-columns:auto auto auto minmax(100px,1fr);gap:7px}
 .in-game .hand-actions .btn,.in-game .hand-actions .quiet{font-size:12px;min-height:40px;padding:7px 8px}
 .in-game .hand-actions #hint[hidden]~#play{grid-column:auto}
}
@media(orientation:landscape) and (max-height:540px){
 .in-game .hand-status{display:flex;width:100%}
 .in-game .hand-actions{display:flex;width:100%;gap:6px}
 .in-game .hand-actions #play{margin-left:auto;flex:0 0 auto}
 .in-game .hand-actions .btn,.in-game .hand-actions .quiet{min-height:34px;font-size:11px;padding:5px 8px}
}
/* Stable actions and an anchored suggestion drawer; never resize the hand on selection. */
.in-game .hand-bar{position:relative;box-shadow:none;border-color:#dce5e1}
.in-game.my-turn .hand-bar{border-color:#75b39b;box-shadow:inset 3px 0 #078460}
.in-game:not(.my-turn) #play:disabled{background:#eef2f0;color:#72847c;border-color:#dde6e1;box-shadow:none}
.in-game #play{min-width:112px;font-variant-numeric:tabular-nums}
.in-game .hand-selection{height:26px;min-height:26px}
.in-game #composer-candidates{position:absolute;z-index:150;top:calc(100% + 5px);left:0;right:0;border-radius:10px;background:#fff;box-shadow:0 8px 24px #163c2926}
.in-game #composer-candidates:empty{display:none}
.in-game #composer-candidates>.quiet-note{display:none}
.in-game #composer-candidates .candidate-list{margin:0;padding:10px;max-height:110px}
.in-game .table:before{opacity:.45}
.in-game .player:not(.turn){background:transparent;box-shadow:none}
.in-game .player.turn{border-color:#078460;box-shadow:0 1px 4px #04785712}
@media(pointer:coarse){.in-game .game-controls button{min-width:36px;min-height:40px}.in-game .hand-actions button{min-height:42px}}
@media(max-width:800px){
 .in-game .hand-selection{display:flex!important;height:24px;min-height:24px;justify-content:flex-start;font-size:11px}
 .in-game .hand-selection .gesture-hint{display:inline;font-size:10px;color:#718379}
 .in-game #play{min-width:104px}
 .in-game .hand-actions #clear{min-width:40px}
}
@media(orientation:landscape) and (max-height:540px){
 .in-game .hand-selection{display:none!important}
 .in-game .hand-actions button{min-height:36px}
 .in-game #composer-candidates .candidate-list{max-height:82px}
}

/* Remaining hands are grouped by element; quantities preserve every remaining card. */
.in-game .player:has(.revealed-hand){align-self:stretch;align-items:flex-start;overflow:hidden}
.in-game .player:has(.revealed-hand)>div{min-width:0;width:100%;min-height:0;max-height:100%;display:flex;flex-direction:column}
.revealed-hand{display:flex;flex-wrap:wrap;gap:3px;overflow:auto;min-height:0;padding:4px 1px;scrollbar-width:thin;overscroll-behavior:contain}
.mini-atom{display:flex;align-items:center;justify-content:center;gap:3px;flex:0 0 auto;padding:4px;border:1px solid #94a3b844;border-radius:4px;background:var(--mini-bg);color:var(--mini-ink);font-size:13px;line-height:1.2}
.mini-atom small{font-size:9px}.empty-hand{font-size:10px;color:#087a58}
/* Ambient material stays behind the whole game and never intercepts input. */
body.in-game[data-substance-phase]{background:color-mix(in srgb,var(--substance-color) 16%,#f7f9fa);transition:background 700ms ease}
.in-game[data-substance-phase] .table{background:color-mix(in srgb,var(--substance-color) 20%,#f4f8f6);border-color:color-mix(in srgb,var(--substance-color) 35%,#dce7e2)}
.in-game[data-substance-phase] .played{border-color:color-mix(in srgb,var(--substance-color) 40%,#dce7e2);box-shadow:0 6px 24px color-mix(in srgb,var(--substance-color) 18%,transparent)}
.ambient-matter{position:fixed;inset:0;pointer-events:none;overflow:hidden;z-index:0;color:var(--substance-color)}
.in-game #root{position:relative;z-index:1}
.ambient-matter i{position:absolute;left:calc(7% + var(--i)*11%);top:calc(12% + var(--i)*8%);opacity:.12;animation:ambient-drift 16s ease-in-out infinite alternate;animation-delay:calc(var(--i)*-2s)}
[data-substance-phase=gas] .ambient-matter i{width:22vw;height:22vw;border-radius:50%;background:radial-gradient(currentColor,transparent 70%);filter:blur(14px)}
[data-substance-phase=liquid] .ambient-matter i{width:30vw;height:12vw;border:2px solid currentColor;border-radius:50%;animation-name:ambient-ripple}
[data-substance-phase=solid] .ambient-matter i{width:36px;height:36px;border:1px solid currentColor;background:linear-gradient(135deg,transparent,currentColor);transform:rotate(35deg);animation:none;opacity:.1}
@keyframes ambient-drift{to{transform:translate(5vw,-5vh) scale(1.3)}}
@keyframes ambient-ripple{from{transform:scale(.65);opacity:.03}to{transform:scale(1.3);opacity:.15}}
@media(prefers-reduced-motion:reduce){.ambient-matter i{animation:none}body.in-game[data-substance-phase]{transition:none}}
@media(max-width:800px){.mini-atom{font-size:11px;padding:3px 2px;gap:2px}.mini-atom small{font-size:8px}.revealed-hand{gap:2px}}

.in-game .player:has(.revealed-hand) .player-name,.in-game .player:has(.revealed-hand) .player-cards{flex-shrink:0}
.in-game.game-finished .hand-actions,.in-game.game-finished #turn-countdown{display:none}
@media(min-height:541px){
 .in-game.game-finished #root{grid-template-rows:auto auto minmax(260px,1.4fr) auto minmax(90px,.6fr)}
 .in-game.game-finished .table{grid-template-columns:170px minmax(0,1fr) 170px}
}
@media(max-width:800px) and (min-height:541px){
 .in-game.game-finished .table{grid-template-columns:78px minmax(0,1fr) 78px}
}

/* Material cues: restrained reflections, facets and grains, no reaction/fire imagery. */
[data-substance-material=metal] .ambient-matter i{width:8vw;height:65vh;top:8%;border:0;border-radius:0;opacity:.1;background:linear-gradient(90deg,transparent,var(--substance-highlight),currentColor,transparent);transform:rotate(25deg);animation:metal-reflection 18s ease-in-out infinite alternate}
[data-substance-material=crystal] .ambient-matter i{clip-path:polygon(25% 0,80% 8%,100% 60%,55% 100%,0 65%);background:linear-gradient(135deg,var(--substance-highlight),currentColor 50%,transparent);animation:facet-light 10s ease-in-out infinite alternate}
[data-substance-material=powder] .ambient-matter i{width:90px;height:65px;border:0;transform:none;background:radial-gradient(circle,currentColor 1px,transparent 2px);background-size:8px 9px;opacity:.11;animation:none}
[data-substance-material=graphite] .ambient-matter i{width:100px;height:45px;border:0;background:repeating-linear-gradient(0deg,currentColor 0 1px,transparent 1px 7px);transform:rotate(-25deg);animation:none}
[data-substance-material=viscous] .ambient-matter i{width:18vw;height:35vh;border-radius:42% 58% 55% 45%;border:1px solid currentColor;background:linear-gradient(110deg,transparent,var(--substance-highlight),transparent);animation:slow-flow 24s ease-in-out infinite alternate}
[data-substance-material=mercury] .ambient-matter i{width:8vw;height:8vw;border:0;border-radius:50%;background:radial-gradient(circle at 32% 25%,white 4%,var(--substance-highlight) 16%,currentColor 40%,#495969 70%,transparent 72%);opacity:.15;animation:slow-flow 20s ease-in-out infinite alternate}
[data-substance-material=semiconductor] .ambient-matter i{clip-path:polygon(30% 0,70% 0,100% 40%,85% 100%,15% 100%,0 40%);background:linear-gradient(135deg,var(--substance-highlight),currentColor 45%,transparent);opacity:.13;animation:facet-light 12s ease-in-out infinite alternate}
[data-substance-material=waxy] .ambient-matter i{width:14vw;height:14vw;border-radius:48% 52% 56% 44%;border:1px solid currentColor;background:radial-gradient(ellipse at 40% 40%,var(--substance-highlight),currentColor 60%,transparent);opacity:.12;animation:none;transform:rotate(12deg)}
/* Even elements mark the liquid surface, odd elements suggest mist above it. */
[data-substance-material=fuming] .ambient-matter i{width:20vw;height:8vw;border:1px solid currentColor;border-radius:50%;background:transparent;filter:none;opacity:.09;animation:ambient-ripple 18s ease-in-out infinite alternate}
[data-substance-material=fuming] .ambient-matter i:nth-child(odd){width:18vw;height:18vw;border:0;background:radial-gradient(currentColor,transparent 68%);filter:blur(12px);opacity:.1;animation:fuming-vapor 16s ease-in-out infinite alternate}
.in-game[data-substance-material=metal] .played,.in-game[data-substance-material=mercury] .played{background:linear-gradient(120deg,#ffffff 15%,color-mix(in srgb,var(--substance-color) 14%,white) 42%,var(--substance-highlight) 49%,#fff 60%)}
.in-game[data-substance-material=semiconductor] .played{background:linear-gradient(130deg,#ffffff 18%,color-mix(in srgb,var(--substance-color) 12%,white) 44%,var(--substance-highlight) 52%,#ffffff 62%)}
.in-game[data-substance-material=waxy] .played{background:radial-gradient(ellipse at 50% 50%,color-mix(in srgb,var(--substance-color) 10%,white) 30%,#ffffff 80%)}
.in-game[data-substance-material=fuming] .played{background:radial-gradient(circle at 50% 60%,color-mix(in srgb,var(--substance-color) 16%,white),#ffffff 75%)}
.in-game[data-substance-material=powder] .played{background:radial-gradient(color-mix(in srgb,var(--substance-color) 12%,white) .7px,transparent 1px) 0 0/5px 5px,#fff}
.substance-effect.powder i{border-radius:50%;clip-path:none;width:4px;height:4px}
.substance-effect.metal,.substance-effect.mercury{background:linear-gradient(115deg,transparent 20%,color-mix(in srgb,var(--effect-color) 14%,transparent) 45%,#ffffff66 50%,transparent 65%)}
.substance-effect.semiconductor{background:linear-gradient(125deg,transparent 25%,color-mix(in srgb,var(--effect-color) 16%,transparent) 48%,#ffffff88 52%,transparent 70%)}
.substance-effect.waxy{background:radial-gradient(circle at 50% 50%,color-mix(in srgb,var(--effect-color) 18%,transparent),transparent 75%)}
.substance-effect.fuming{background:radial-gradient(ellipse at 50% 50%,color-mix(in srgb,var(--effect-color) 22%,transparent),transparent 72%)}
@keyframes metal-reflection{to{transform:translateX(4vw) rotate(25deg);opacity:.17}}
@keyframes facet-light{to{opacity:.19}}
@keyframes slow-flow{to{transform:translateY(3vh) scale(.95,1.08)}}
@keyframes fuming-vapor{0%{transform:translateY(0) scale(1);opacity:.10}100%{transform:translateY(-4vh) scale(1.15);opacity:.18}}
@media(max-width:800px){.ambient-matter i:nth-child(n+7){display:none}}
@media(prefers-reduced-motion:reduce){body .ambient-matter i{animation:none!important}}

/* Crystal facets, unlike the colder semiconductor surfaces, retain static outlines. */
[data-substance-material=semiconductor] .ambient-matter i{animation:none;background:linear-gradient(125deg,transparent 25%,var(--substance-highlight) 48%,currentColor 51%,transparent 73%)}
.in-game[data-substance-material=fuming] .played{background:linear-gradient(0deg,color-mix(in srgb,var(--substance-color) 12%,white) 0 22%,#fff 23% 100%)}
