:root { --galaxeggy-text-scale: 1; }
.galaxeggy-sr-only { position:absolute!important;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0; }
#galaxeggySettingsButton { min-width:48px;min-height:48px;font-size:20px;letter-spacing:0;padding:7px; }
#galaxeggySettings { width:min(620px,calc(100vw - 20px));max-height:calc(100dvh - 20px);margin:auto;padding:20px;color:#f5eefb;background:#29233c;border:2px solid #a393be;border-radius:16px;overflow:auto;overscroll-behavior:contain;font:calc(14px * var(--galaxeggy-text-scale))/1.5 "DM Sans",sans-serif; }
#galaxeggySettings::backdrop { background:#100e1bba; }
.galaxeggy-settings-head { display:flex;align-items:center;gap:10px;justify-content:space-between;position:sticky;top:-20px;background:#29233c;padding:8px 0;z-index:2; }
#galaxeggySettings h2 { font:700 1.4em/1.2 "DM Sans",sans-serif;margin:0;letter-spacing:0; }
#galaxeggySettings button,#galaxeggySettings select { min-height:48px;font:inherit; }
#galaxeggySettingsClose { flex:none;min-width:48px; }
#galaxeggySettings p { font:inherit;color:#d2c8e1; }
.galaxeggy-settings-grid { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:18px 0; }
#galaxeggySettings label { display:grid;gap:5px;min-width:0; }
#galaxeggySettings select { width:100%;min-width:0;max-width:100%;background:#3a314e;color:#fff;border:1px solid #b0a0c5;border-radius:7px;padding:9px 6px; }
#galaxeggySettings details { border-top:1px solid #756386;padding:10px 0; }
#galaxeggySettings summary { min-height:48px;cursor:pointer;display:list-item;align-content:center;font-weight:700; }
.galaxeggy-binding-list { display:grid;gap:8px; }
.galaxeggy-binding-list>div,.galaxeggy-binding-list>label { display:grid!important;grid-template-columns:minmax(0,1fr) minmax(90px,45%);align-items:center;gap:12px!important; }
.galaxeggy-binding-list button { word-break:break-word; }
#galaxeggySettingsNote { min-height:1.5em; }
.galaxeggy-settings-hint { font-size:.9em!important; }
#galaxeggySettingsReset { width:100%; }
:where(button,select,input,summary,a,[tabindex]):focus-visible,.galaxeggy-controller-focus { outline:3px solid #ffe5a0!important;outline-offset:3px;box-shadow:0 0 0 5px #201628!important; }
#overlay .modal>button[data-controls-settings] { margin-top:14px;min-height:48px;width:100%; }
body:not([data-text-scale="100"]) .modal :is(p,button,select,summary,label,.weapon-slot,.card,.save-note,.set-bonuses,.stat-grid,.section-heading span) { font-size:calc(13px * var(--galaxeggy-text-scale)); }
body:not([data-text-scale="100"]) .modal :is(small,.tag) { font-size:calc(11px * var(--galaxeggy-text-scale)); }
body:not([data-text-scale="100"]) .modal :is(button,select,summary) { min-height:48px; }
body:not([data-text-scale="100"]) .modal button { white-space:normal;overflow-wrap:anywhere; }
body[data-reduced-effects="true"] :is(.modal,button,.card,.powerup-chip,#notice,#bossHud,.boss-hud) { animation:none!important;transition:none!important; }
#galaxeggyTouchAim { position:absolute;right:18px;bottom:146px;width:88px;height:88px;z-index:5;border:2px solid #9cf3dbb0;border-radius:50%;background:#233a48ab;touch-action:none;user-select:none; }
#galaxeggyTouchAim[hidden] { display:none; }
#galaxeggyTouchAim>span { position:absolute;left:calc(50% - 13px);top:calc(50% - 13px);width:26px;height:26px;border:2px solid #dcfff4;border-radius:50%;background:#46bcaa;pointer-events:none; }
#galaxeggyTouchAim small { position:absolute;bottom:3px;left:0;width:100%;text-align:center;font-size:10px;color:#fff;pointer-events:none; }
@media(max-width:430px) {
  header { gap:5px; }
  #galaxeggySettingsButton { min-width:48px;padding:5px; }
  #galaxeggySettings { padding:15px; }
  .galaxeggy-settings-head { top:-15px; }
  .galaxeggy-settings-grid { grid-template-columns:1fr;gap:10px; }
  .galaxeggy-binding-list>label { grid-template-columns:1fr!important;gap:4px!important; }
}
@media(max-height:500px) and (orientation:landscape) { #galaxeggyTouchAim { bottom:94px;width:74px;height:74px; } }

/* The touch surfaces occupy reserved space; they never sit above the game canvas. */
:root { --touch-scale:1; }
.touch-zone { display:contents; }
@media(max-width:1000px),(pointer:coarse) {
  .playfield { --controls-height:calc(168px * var(--touch-scale));--gutter:calc(142px * var(--touch-scale)); }
  body[data-touch-aim="true"] .playfield { --controls-height:calc(230px * var(--touch-scale)); }
  .playfield::after { display:none; }
  .playfield canvas { left:0;top:0;width:100%;height:calc(100% - var(--controls-height)); }
  .touch-zone { display:block;position:absolute;bottom:0;width:50%;height:var(--controls-height);z-index:4;background:#211d32;border-top:1px solid #61516e;touch-action:none;user-select:none;-webkit-user-select:none;overflow:hidden; }
  #moveZone { left:0; }
  #actionZone { right:0;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;gap:6px;padding:10px 7px; }
  body[data-handedness="left"] #moveZone { left:auto;right:0; }
  body[data-handedness="left"] #actionZone { right:auto;left:0; }
  #moveZone #stick { display:block;position:absolute;left:50%;top:calc(100% - 78px * var(--touch-scale));bottom:auto;width:calc(100px * var(--touch-scale));height:calc(100px * var(--touch-scale));transform:translate(-50%,-50%);pointer-events:none; }
  body[data-touch-position="center"] #moveZone #stick { top:50%; }
  body[data-touch-position="center"] #actionZone { justify-content:center; }
  #stick.active { background:#51415b;border-color:#fff0b0; }
  #stick small { font-size:10px;letter-spacing:1px; }
  #actionZone .abilities { position:static;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:auto auto;gap:6px;width:100%;max-width:calc(148px * var(--touch-scale));transform:none;margin:0; }
  #actionZone .abilities button { width:100%;height:calc(56px * var(--touch-scale));min-width:48px;min-height:56px;grid-template-columns:1fr;grid-template-rows:20px 12px 12px;padding:4px;box-shadow:none; }
  #actionZone #dash { min-height:calc(68px * var(--touch-scale));grid-column:2;grid-row:1;background:#78532a;border-color:#ffe2a0;color:#fff2c9; }
  #actionZone #cryo { grid-column:1;grid-row:1;align-self:end; }
  #actionZone #pulse { grid-column:1;grid-row:2; }
  #actionZone #mineTouch { display:grid;grid-column:2;grid-row:2; }
  #actionZone .abilities b { font-size:20px;line-height:1; }
  #actionZone .abilities span { font-size:11px;line-height:1.1;letter-spacing:0; }
  #actionZone .abilities small { font-size:10px;line-height:1.2;grid-column:1; }
  #galaxeggyTouchAim { position:relative;inset:auto;width:calc(78px * var(--touch-scale));height:calc(78px * var(--touch-scale));min-height:0;flex:none;margin:0; }
  #galaxeggyTouchAim.active { border-color:#e3fff4;background:#37656c; }
  .run-build { left:8px;right:8px;bottom:calc(var(--controls-height) + 5px); }
  #weaponBelt span { font-size:11px;line-height:1.25; }
  #overlay { z-index:10; }
  #galaxeggySettings button,#galaxeggySettings select,#galaxeggySettings summary { min-height:48px; }
}
@media(orientation:landscape) and (max-width:1000px),(orientation:landscape) and (pointer:coarse) {
  .playfield { --controls-height:0px; }
  body[data-touch-aim="true"] .playfield { --controls-height:0px; }
  .playfield canvas { left:var(--gutter);width:calc(100% - var(--gutter) * 2);height:100%; }
  .touch-zone { width:var(--gutter);height:100%;border-top:0; }
  #moveZone { border-right:1px solid #61516e; }
  #actionZone { border-left:1px solid #61516e;padding-top:60px; }
  #actionZone .abilities { max-width:100%; }
  #moveZone #stick { top:calc(100% - 76px * var(--touch-scale)); }
  .mobile-hud { top:6px;left:6px;width:calc(var(--gutter) - 12px);padding:5px 7px;z-index:5; }
  .mobile-vitals>span { display:none; }
  .mobile-hud .bar { margin:4px 0; }
  .timer { top:6px;right:6px;width:calc(var(--gutter) - 12px);padding:4px 8px;z-index:5;pointer-events:none; }
  body[data-handedness="left"] .mobile-hud { left:auto;right:6px; }
  body[data-handedness="left"] .timer { right:auto;left:6px; }
  .timer small { display:block;font-size:8px;line-height:10px; }
  .timer strong { font-size:24px;line-height:26px; }
  .timer>div { margin-top:3px; }
  .run-build { left:calc(var(--gutter) + 6px);right:calc(var(--gutter) + 6px);bottom:5px; }
  #notice { left:var(--gutter);right:var(--gutter);top:80px;padding:0 6px; }
  #weaponBelt { grid-template-columns:repeat(3,minmax(0,1fr)); }
  #weaponBelt span { font-size:11px;padding:2px 4px; }
}
/* Every wave has a boss HUD; reserve room for optional objectives and both thumbs. */
@media(orientation:landscape) and (max-height:550px) {
  .boss-hud { display:flex;align-items:center;gap:12px;padding:3px 12px; }
  .boss-hud > div:first-child { margin:0;flex:1;line-height:11px; }
  .boss-hud .boss-track { flex:1; }
  .timer { top:4px; }
  .timer small { display:none; }
  #actionZone { padding-top:48px;padding-bottom:6px;gap:2px; }
  #galaxeggyTouchAim { width:48px;height:48px; }
  #actionZone .abilities { gap:4px; }
  #actionZone .abilities button { height:56px; }
  #actionZone #dash { min-height:56px; }
  #moveZone #stick { max-width:110px;max-height:110px; }
  #weaponBelt { display:none; }
  .tutorial-hud { font-size:10px; }
}
@media(orientation:landscape) and (max-height:420px) {
  #actionZone .abilities button { height:48px;min-height:48px;grid-template-rows:16px 11px 11px;padding:3px; }
  #actionZone #dash { min-height:48px; }
  #actionZone .abilities b { font-size:16px; }
  #actionZone .abilities span { font-size:10px; }
  #actionZone .abilities small { font-size:9px; }
}
