/* Everything is scoped to this page; the original game and portal styles stay independent. */
body:has(.pd-page) { background: radial-gradient(ellipse at 45% 0, #1b2033, #090f1b 65%); }
#app:has(.pd-page) { width: 100%; padding: 20px 24px 20px; }
.pd-page { --pd-acid: #74e6f0; --pd-orange: #ffcb67; --pd-teal: #74e6f0; max-width: 900px; margin: 0 auto; }
.pd-page [hidden] { display: none !important; }
.pd-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 0 14px; }
.pd-eyebrow, .pd-record > span, .pd-hud > div > span, .pd-card-top, .pd-overlay-kicker, .pd-result > span { font: 600 10px/1.4 ui-monospace, Consolas, monospace; letter-spacing: 1.6px; color: #97aab3; }
.pd-eyebrow { display: flex; align-items: center; gap: 7px; margin: 0 0 5px; }
.pd-eyebrow > span { width: 6px; height: 6px; background: var(--pd-acid); box-shadow: 0 0 12px #d5f76d44; }
.pd-heading h1 { margin: 0; font-size: 31px; font-weight: 850; letter-spacing: -1.2px; line-height: 1.1; color: #f1f7f5; }
.pd-heading h1 > span { color: var(--pd-acid); }
.pd-heading h1 > small { display: inline-block; vertical-align: middle; margin-left: 12px; padding: 5px 7px; border: 1px solid #3a4943; color: #a5b2ac; font: 600 9px/1 ui-monospace, Consolas, monospace; letter-spacing: 1px; }
.pd-record { text-align: right; }
.pd-record > span { display: block; margin-bottom: 2px; font-size: 9px; }
.pd-record strong { font: 700 25px/1.1 ui-monospace, Consolas, monospace; color: var(--pd-acid); font-variant-numeric: tabular-nums; }
.pd-layout { display: grid; grid-template-columns: minmax(0, 480px) minmax(230px, 290px); align-items: start; justify-content: space-between; gap: 35px; }
.pd-game { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.pd-hud { width: 100%; display: flex; align-items: center; gap: 22px; padding: 12px 14px; background: #162128; border: 1px solid #314149; border-bottom: 0; border-radius: 7px 7px 0 0; }
.pd-hud > div > span { display: block; font-size: 8px; letter-spacing: 1px; margin-bottom: 3px; }
.pd-hud strong { display: block; color: #f0f6f3; font: 700 18px/1.2 ui-monospace, Consolas, monospace; font-variant-numeric: tabular-nums; }
.pd-hud strong small { color: #6c848f; font-size: 11px; }
.pd-health { margin-left: auto; }
.pd-health strong { color: var(--pd-acid); font-size: 14px; letter-spacing: 1px; white-space: nowrap; }
.pd-tools { display: flex; gap: 6px; }
.pd-icon-button { position: relative; width: 38px; min-height: 42px; padding: 5px; border: 1px solid #354750; border-radius: 4px; color: #d3e2df; background: #1d2c34; font-size: 20px; line-height: 1; }
.pd-icon-button:hover { border-color: var(--pd-teal); background: #243b43; }
.pd-icon-button:disabled { opacity: .4; cursor: default; }
.pd-sound-off { position: absolute; right: 5px; top: 2px; font-size: 12px; color: var(--pd-orange); }
.pd-icon-button[aria-pressed="true"] .pd-sound-off { display: none; }
.pd-stage { position: relative; width: 100%; aspect-ratio: 3 / 4; overflow: hidden; background: #111d24; border: 1px solid #314149; }
#pd-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
#pd-canvas:focus-visible { outline: 2px solid var(--pd-teal); outline-offset: -3px; }
.pd-wave-track { position: absolute; inset: auto 0 0; height: 3px; background: #25343b; pointer-events: none; }
.pd-wave-track > span { display: block; width: 0; height: 100%; background: var(--pd-acid); transition: width .2s linear; }
.pd-overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 18px; background: #08121991; backdrop-filter: blur(2px); }
.pd-overlay-card { width: 100%; max-width: 345px; padding: 28px 24px 22px; text-align: center; background: #102027f5; border: 1px solid #53654c; box-shadow: 6px 6px 0 #07111688; }
.pd-overlay-kicker { color: var(--pd-acid); margin: 0 0 20px; font-size: 10px; }
.pd-pixel-emblem { display: flex; justify-content: center; align-items: center; gap: 4px; height: 24px; margin: 0 auto 18px; }
.pd-pixel-emblem i { width: 7px; height: 14px; background: #d5f76d; transform: skewY(-25deg); }
.pd-pixel-emblem i:nth-child(2), .pd-pixel-emblem i:nth-child(4) { height: 20px; opacity: .7; }
.pd-pixel-emblem i:nth-child(3) { height: 28px; }
.pd-overlay h2 { margin: 0 0 14px; font-size: clamp(23px, 3vw, 33px); line-height: 1.08; font-weight: 800; letter-spacing: -.9px; color: #f4faf5; }
.pd-overlay h2 span { color: var(--pd-acid); }
#pd-overlay-description { color: #b4c7cc; font-size: 13px; line-height: 1.65; margin: 0 0 22px; }
.pd-primary-button { display: flex; align-items: center; justify-content: center; gap: 20px; width: 100%; min-height: 48px; padding: 12px 18px; background: var(--pd-acid); border: 1px solid var(--pd-acid); color: #172117; border-radius: 3px; font-size: 14px; font-weight: 750; }
.pd-primary-button:hover { background: #e5ffa0; }
.pd-primary-button:disabled { opacity: .6; }
.pd-primary-button > span { font-size: 22px; line-height: 1; }
.pd-secondary-button { margin: 12px auto 0; background: transparent; border: 0; color: #b8c6cc; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; min-height: 34px; }
.pd-overlay-hint { font-size: 10px; color: #90a7af; line-height: 1.5; margin: 14px 0 0; }
.pd-result { border-top: 1px solid #33484d; padding-top: 14px; margin-bottom: 19px; }
.pd-result > strong { display: block; color: var(--pd-acid); font: 700 35px/1.3 ui-monospace, Consolas, monospace; }
.pd-result > small { font-size: 11px; color: #b8d1bd; }
.pd-lane-controls { display: grid; grid-template-columns: 46px minmax(0, 1fr) 46px; align-items: center; gap: 12px; width: 100%; background: #162128; border: 1px solid #314149; border-top: 0; border-radius: 0 0 6px 6px; overflow: hidden; }
.pd-lane-controls button { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; border: 0; background: #162128; color: #a2b6bf; font-size: 12px; font-weight: 650; touch-action: manipulation; }
.pd-lane-controls button { color: var(--pd-acid); }
.pd-lane-controls button:disabled { opacity: .4; }
.pd-position { display: block; width: 100%; min-width: 0; height: 32px; padding: 0; margin: 0; cursor: ew-resize; accent-color: var(--pd-acid); touch-action: none; }
.pd-position:disabled { opacity: .4; }
.pd-lane-controls button:hover { background: #273c36; }
.pd-lane-controls button > span { font-size: 19px; line-height: 1; }
.pd-lane-controls kbd { background: #26363a; color: #8da69f; font-size: 9px; padding: 2px 4px; }
.pd-controls-help { font-size: 11px; line-height: 1.5; color: #8fa6b0; text-align: center; margin: 10px 0 0; max-width: 400px; }
.pd-briefing { min-width: 0; padding-top: 1px; }
.pd-weapon-card { padding: 21px; background: #152128; border: 1px solid #34484b; border-radius: 6px; }
.pd-card-top { display: flex; justify-content: space-between; gap: 8px; font-size: 9px; letter-spacing: 1px; }
.pd-card-top > span:last-child { color: var(--pd-acid); white-space: nowrap; }
.pd-weapon-card h2 { margin: 0 0 6px; font-size: 20px; font-weight: 700; color: #ebf4ef; }
#pd-weapon-detail { margin: 0; color: #a4bac1; font-size: 12px; }
.pd-volley { display: flex; align-items: baseline; gap: 10px; margin-top: 13px; }
.pd-volley strong { color: var(--pd-acid); font: 800 30px/1.2 ui-monospace, Consolas, monospace; }
.pd-volley span { color: #a4bac1; font-size: 11px; }
.pd-weapon-levels { display: flex; gap: 5px; margin: 19px 0 15px; }
.pd-weapon-levels i { height: 5px; background: #30454c; flex: 1; }
.pd-weapon-levels i.is-active { background: var(--pd-acid); }
.pd-weapon-tip { padding-top: 13px; border-top: 1px solid #2f4147; color: #9fb4b9; font-size: 11px; line-height: 1.6; margin: 0; }
.pd-field-guide { margin-top: 28px; }
.pd-field-guide ol { list-style: none; padding: 0; margin: 18px 0 0; }
.pd-field-guide li { display: flex; gap: 13px; margin-top: 20px; }
.pd-guide-number { color: #668478; font: 500 12px/1.8 ui-monospace, Consolas, monospace; }
.pd-field-guide h3 { color: #dce9e3; font-size: 13px; font-weight: 650; margin: 0 0 6px; }
.pd-field-guide li p { font-size: 12px; line-height: 1.7; color: #9bb0ba; margin: 0; }
.pd-session-note { display: flex; gap: 12px; border-top: 1px solid #293c43; margin-top: 25px; padding-top: 18px; }
.pd-session-note > span { color: var(--pd-acid); font-size: 20px; }
.pd-session-note p { font-size: 11px; line-height: 1.7; color: #97acb5; margin: 0; }
#pd-save-note { display: block; color: var(--pd-orange); margin-top: 5px; }
.pd-back { display: inline-block; color: #aec3c5; font-size: 12px; margin-top: 20px; text-decoration: none; padding: 6px 0; }
.pd-back:hover { color: var(--pd-acid); }
.pd-notice { color: var(--pd-orange); font-size: 13px; }
@media (min-width: 741px) {
    .pd-game { width: min(100%, calc((100svh - 285px) * .75)); min-width: 275px; justify-self: center; }
    .pd-hud { gap: 12px; padding: 8px 10px; }
    .pd-icon-button { width: 32px; }
}
@media (max-width: 740px) {
    #app:has(.pd-page) { padding: 15px 16px 20px; }
    .pd-heading { max-width: 480px; margin: 0 auto 12px; }
    .pd-heading h1 { font-size: 26px; }
    .pd-heading h1 > small { font-size: 8px; margin-left: 8px; }
    .pd-eyebrow { font-size: 8px; letter-spacing: 1.1px; }
    .pd-record strong { font-size: 22px; }
    .pd-record > span { font-size: 8px; letter-spacing: .8px; }
    .pd-layout { grid-template-columns: minmax(0, 480px); justify-content: center; gap: 22px; }
    .pd-game { width: min(100%, calc((100svh - 260px) * .75)); min-width: 230px; justify-self: center; }
    .pd-hud { gap: 12px; padding: 8px 10px; }
    .pd-hud strong { font-size: 16px; }
    .pd-health strong { font-size: 12px; letter-spacing: 0; }
    .pd-hud > div > span { font-size: 7px; }
    .pd-icon-button { width: 30px; min-height: 38px; font-size: 17px; }
    .pd-tools { gap: 4px; }
    .pd-lane-controls kbd { display: none; }
    .pd-controls-help { font-size: 10px; margin-top: 7px; }
    .pd-briefing { max-width: 480px; }
    .pd-weapon-card { padding: 16px 18px; }
    .pd-ship-display { float: right; transform: rotate(-8deg) scale(.7); transform-origin: right center; margin: 4px 0 -30px -35px; }
    .pd-weapon-card h2 { margin-top: 16px; font-size: 18px; }
    .pd-weapon-levels { margin-top: 15px; }
    .pd-field-guide { margin-top: 24px; }
    .pd-overlay { padding: 13px; }
    .pd-overlay-card { padding: 19px 16px 16px; }
    .pd-overlay h2 { font-size: 26px; }
    .pd-overlay-kicker { margin-bottom: 14px; font-size: 9px; }
    .pd-pixel-emblem { margin-bottom: 14px; }
    #pd-overlay-description { font-size: 12px; line-height: 1.6; margin-bottom: 17px; }
    .pd-overlay-hint { margin-top: 11px; font-size: 9px; }
}
@media (max-height: 720px) and (max-width: 740px) {
    .pd-overlay-card { padding: 16px 13px 13px; }
    .pd-pixel-emblem { display: none; }
    .pd-overlay h2 { font-size: 23px; margin-bottom: 10px; }
    .pd-overlay-kicker { margin-bottom: 10px; }
    #pd-overlay-description { display: none; }
    .pd-result { padding-top: 8px; margin-bottom: 12px; }
    .pd-result > strong { font-size: 27px; }
}
@media (max-width: 360px) {
    .pd-heading { gap: 12px; }
    .pd-heading h1 > small { display: none; }
}
@media (min-width: 741px) and (max-height: 800px) {
    .pd-pixel-emblem { display: none; }
    .pd-overlay-card { padding: 20px 17px; }
    .pd-overlay h2 { font-size: 25px; }
    .pd-overlay-kicker { margin-bottom: 13px; }
    #pd-overlay-description { font-size: 12px; margin-bottom: 16px; }
}
@media (orientation: landscape) and (max-height: 600px) {
    body:has(.pd-page) .site-header, body:has(.pd-page) .site-footer { display: none; }
    #app:has(.pd-page) { padding: 10px 20px; }
    .pd-page { max-width: 720px; }
    .pd-heading { margin-bottom: 8px; }
    .pd-heading h1 { font-size: 23px; }
    .pd-heading .pd-eyebrow { display: none; }
    .pd-layout { grid-template-columns: minmax(220px, 1fr) minmax(200px, 1fr); gap: 24px; }
    .pd-game { width: min(100%, calc((100svh - 145px) * .75)); min-width: 180px; }
    .pd-hud { gap: 8px; padding: 5px 8px; }
    .pd-hud strong { font-size: 13px; }
    .pd-health { display: none; }
    .pd-tools { margin-left: auto; }
    .pd-icon-button { min-height: 30px; width: 27px; padding: 4px; font-size: 16px; }
    .pd-lane-controls button { min-height: 36px; font-size: 10px; gap: 6px; }
    .pd-lane-controls kbd, .pd-controls-help, .pd-pixel-emblem, .pd-overlay-hint { display: none; }
    .pd-overlay { padding: 8px; }
    .pd-overlay-card { padding: 12px 10px; }
    .pd-overlay h2 { font-size: 20px; margin-bottom: 8px; }
    .pd-overlay-kicker { font-size: 8px; margin-bottom: 8px; }
    #pd-overlay-description { display: none; }
    .pd-primary-button { min-height: 38px; font-size: 12px; padding: 8px; }
    .pd-result { padding-top: 6px; margin-bottom: 8px; }
    .pd-result > strong { font-size: 25px; }
    .pd-field-guide { margin-top: 16px; }
    .pd-field-guide li { margin-top: 12px; }
    .pd-session-note { margin-top: 16px; padding-top: 12px; }
    .pd-ship-display { display: none; }
    .pd-weapon-card { padding: 12px 16px; }
    .pd-weapon-card h2 { margin-top: 10px; }
}
@media (prefers-reduced-motion: reduce) { .pd-wave-track > span { transition: none; } }
.pd-quick-rules { margin: 0; font-size: 12px; }
.pd-quick-rules > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #2b3e49; }
.pd-quick-rules dt { font-weight: 500; color: #b8c9d1; }
.pd-quick-rules dd { margin: 0; text-align: right; font-size: 11px; color: #d9e6ec; }
.pd-quick-rules .pd-rule-gold { color: #ffcb67; }
.pd-quick-rules .pd-rule-cyan { color: #74e6f0; }
.pd-quick-note { color: #97acb5; font-size: 11px; line-height: 1.6; margin: 12px 0 0; }
/* Campaign and ship styling are confined to Pixel Front. */
.pd-heading h1 > span { color: var(--pd-orange); }
.pd-hud, .pd-lane-controls, .pd-weapon-card { background: #111d2c; border-color: #2b4056; }
.pd-stage { border-color: #35516a; box-shadow: 0 0 38px #32b9dc0a; }
.pd-overlay-card { background: #0d1b2cf2; border-color: #4b7691; box-shadow: 5px 5px 0 #03091388, 0 0 35px #56d8f20d; }
.pd-overlay-kicker, .pd-record strong { color: var(--pd-orange); }
.pd-primary-button { background: var(--pd-orange); border-color: var(--pd-orange); color: #211a0d; }
.pd-primary-button:hover { background: #ffe0a2; }
.pd-pixel-emblem i { background: var(--pd-teal); }
.pd-weapon-levels i.is-active { background: var(--pd-orange); }
.pd-wave-track > span { background: var(--pd-teal); }
.pd-lane-controls button { background: #111d2c; }
.pd-lane-controls button:hover { background: #1c3548; }
.pd-campaign { margin: 0 0 14px; border: 1px solid #2b4056; border-radius: 6px; background: #101b2a; overflow: hidden; }
.pd-campaign summary { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 14px 16px; min-height: 48px; list-style: none; color: #d4e9f0; font-size: 12px; font-weight: 650; }
.pd-campaign summary::-webkit-details-marker { display: none; }
.pd-campaign summary strong { margin-left: auto; color: var(--pd-orange); font: 600 12px ui-monospace, Consolas, monospace; white-space: nowrap; }
.pd-campaign summary:hover { background: #172b3d; }
.pd-campaign > p { font-size: 11px; color: #9eb6c9; padding: 0 16px; margin: 0 0 12px; line-height: 1.6; }
.pd-level-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; padding: 0 14px 15px; }
.pd-level-grid button { min-height: 40px; padding: 6px 2px; background: #172c40; border: 1px solid #365771; border-radius: 3px; color: #d4f6ff; font: 600 12px ui-monospace, Consolas, monospace; touch-action: manipulation; }
.pd-level-grid button:disabled { color: #728498; border-color: #243448; background: #101b2b; cursor: default; }
.pd-level-grid button.is-complete { color: #74e6f0; border-color: #2c7782; }
.pd-level-grid button.is-selected { color: #ffe1a3; border-color: #ffcb67; background: #44351c; }
.pd-level-grid button:focus-visible, .pd-campaign summary:focus-visible { outline: 2px solid var(--pd-teal); outline-offset: -3px; }
.pd-loadout-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pd-loadout-stats .pd-volley { display: block; }
.pd-loadout-stats .pd-volley span { display: block; margin-top: 3px; }
.pd-loadout-stats .pd-volley:last-child strong { color: var(--pd-orange); }
.pd-ship-display { position: relative; width: 124px; height: 90px; margin: 20px auto 10px; transform: none; filter: drop-shadow(0 0 12px #73e8f12a); }
.pd-ship-display i { display: block; position: absolute; }
.pd-ship-display i:first-child { inset: 0 36px 12px; background: #c4f0f3; clip-path: polygon(50% 0, 72% 38%, 82% 78%, 100% 100%, 0 100%, 18% 78%, 28% 38%); }
.pd-ship-display i:nth-child(2) { inset: 30px 4px 17px; background: #4cb7d2; clip-path: polygon(20% 0, 42% 38%, 58% 38%, 80% 0, 100% 100%, 0 100%); }
.pd-ship-display i:nth-child(3) { width: 13px; height: 24px; top: 35px; left: 55px; background: #122c45; box-shadow: 0 38px 0 -3px #ffc664; }
@media (max-width: 740px) {
    .pd-ship-display { float: right; width: 124px; transform: scale(.7); transform-origin: right center; margin: 0 0 -27px -20px; }
    .pd-level-grid { grid-template-columns: repeat(10,minmax(0,1fr)); gap: 5px; }
    .pd-level-grid button { min-height: 36px; font-size: 10px; }
}
@media (max-width: 360px) {
    .pd-level-grid { grid-template-columns: repeat(5,minmax(0,1fr)); }
}
@media (orientation: landscape) and (max-height: 600px) { .pd-ship-display { display: none; } }
