:root { --ghost-court: #1b2932; --ghost-line: #b95d5d; }
body { min-height: 100vh; }
.ghost-page { max-width: 1220px; margin: 0 auto; padding: 28px 20px 64px; }
.ghost-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 28px; margin-bottom: 22px; }
.ghost-back { display: inline-block; color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.ghost-back:hover { color: var(--accent); }
.ghost-kicker { color: var(--accent); font: 600 10px/1 var(--mono); letter-spacing: 2.6px; }
.ghost-head h1 { font-size: clamp(28px, 4vw, 42px); line-height: 1.1; margin-top: 8px; }
.ghost-head h1 em { color: var(--accent); font-style: normal; font-size: .58em; font-weight: 600; }
.ghost-head p { max-width: 690px; color: var(--ink-2); margin-top: 9px; font-size: 13px; }
.ghost-head-actions { display: flex; gap: 8px; flex-shrink: 0; }
.ghost-icon-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 9px; padding: 9px 12px; font-size: 12px; }
.ghost-icon-btn:hover { border-color: var(--muted); color: var(--ink); }

.ghost-layout { display: grid; grid-template-columns: minmax(480px, 1fr) 370px; gap: 18px; align-items: stretch; }
.ghost-stage, .ghost-settings { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.ghost-stage { min-height: 685px; padding: 16px; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.run-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.run-stats > div { padding: 9px 12px; background: var(--surface-2); border-radius: 8px; display: flex; justify-content: space-between; align-items: baseline; }
.run-stats span { color: var(--muted); font-size: 10.5px; letter-spacing: .08em; }
.run-stats b { font: 700 14px/1 var(--mono); }
.run-stats i { font-style: normal; }

.court-wrap { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: center; padding: 14px 0; }
.ghost-court {
  height: 520px; max-height: 62vh; aspect-ratio: 64/94; position: relative; overflow: hidden;
  background: radial-gradient(circle at 50% 58%, rgba(184,241,60,.06), transparent 32%), linear-gradient(155deg, #243741, var(--ghost-court));
  border: 3px solid #52616a; border-radius: 7px 7px 3px 3px; box-shadow: 0 20px 42px rgba(0,0,0,.28), inset 0 0 50px rgba(0,0,0,.18);
}
.front-wall { position: absolute; left: -3px; right: -3px; top: -3px; height: 16px; background: #d9dee0; border-radius: 6px 6px 0 0; z-index: 2; }
.front-wall span { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.38); font-size: 9px; letter-spacing: .3em; white-space: nowrap; }
.court-short { position: absolute; left: 0; right: 0; top: 56%; height: 2px; background: var(--ghost-line); opacity: .85; }
.court-half { position: absolute; top: 56%; bottom: 0; left: 50%; width: 2px; background: var(--ghost-line); opacity: .85; }
.service-box { position: absolute; top: 56%; width: 24%; height: 16%; border-bottom: 2px solid var(--ghost-line); opacity: .85; }
.service-box.left { left: 0; border-right: 2px solid var(--ghost-line); }
.service-box.right { right: 0; border-left: 2px solid var(--ghost-line); }
.target {
  position: absolute; z-index: 4; width: 74px; aspect-ratio: 1; transform: translate(-50%,-50%); border-radius: 50%;
  border: 2px solid rgba(255,255,255,.18); background: rgba(8,13,16,.4); color: rgba(255,255,255,.58);
  display: flex; flex-direction: column; align-items: center; justify-content: center; transition: .18s ease; cursor: default;
}
.target b { font-size: 12px; }.target small { font: 500 7px/1.4 var(--mono); margin-top: 2px; letter-spacing: .06em; }
.target.fl { left: 22%; top: 14%; }.target.fr { left: 78%; top: 14%; }
.target.ml { left: 13%; top: 51%; }.target.mr { left: 87%; top: 51%; }
.target.bl { left: 22%; top: 88%; }.target.br { left: 78%; top: 88%; }
.target.active { border-color: #efffcf; color: #17200c; background: var(--accent); box-shadow: 0 0 0 10px rgba(184,241,60,.16), 0 0 34px rgba(184,241,60,.72); transform: translate(-50%,-50%) scale(1.13); }
.target.dim { opacity: .25; }
.target.active::after { content: ''; position: absolute; inset: -5px; border: 2px solid var(--accent); border-radius: 50%; animation: targetRipple 1.2s ease-out infinite; }
@keyframes targetRipple { to { transform: scale(2.1); opacity: 0; } }
.t-mark { position: absolute; z-index: 3; left: 50%; top: 56%; transform: translate(-50%,-50%); width: 47px; height: 47px; border-radius: 50%; border: 2px dashed rgba(255,255,255,.35); display: grid; place-items: center; color: rgba(255,255,255,.5); font: 800 15px/1 var(--mono); transition: .18s; }
.t-mark.active { color: #15200a; border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 8px rgba(184,241,60,.14); }
.court-message { position: absolute; z-index: 8; left: 50%; top: 34%; transform: translate(-50%,-50%); width: 70%; padding: 15px; border-radius: 12px; text-align: center; background: rgba(10,15,19,.82); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.1); transition: .2s; }
.court-message.hidden { opacity: 0; pointer-events: none; transform: translate(-50%,-45%); }
.court-message span { color: var(--accent); font: 600 8px/1 var(--mono); letter-spacing: .24em; }
.court-message b { display: block; font-size: 20px; margin-top: 5px; }.court-message small { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
.court-message.count b { color: var(--accent); font: 900 64px/1 var(--mono); }
.run-controls { display: flex; justify-content: center; gap: 9px; min-height: 48px; }
.ghost-btn { min-width: 124px; padding: 12px 20px; border-radius: 9px; border: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.ghost-btn.primary { background: var(--accent); color: #10140b; border-color: var(--accent); }
.ghost-btn.danger { display: none; background: transparent; color: var(--red); border-color: rgba(242,109,109,.35); }
#pause-btn { display: none; }
.keyboard-hint { text-align: center; color: var(--muted); font-size: 9.5px; margin-top: 8px; }

.ghost-settings { padding: 20px; }
.settings-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-bottom: 15px; border-bottom: 1px solid var(--line-soft); }
.settings-title span:first-child { color: var(--accent); font: 600 9px/1 var(--mono); letter-spacing: .18em; }
.settings-title h2 { font-size: 18px; margin-top: 5px; }
.estimate { text-align: right; background: var(--accent-soft); padding: 7px 10px; border-radius: 8px; }
.estimate small { display: block; color: var(--muted); font-size: 9px; }.estimate b { color: var(--accent); font: 700 15px/1.3 var(--mono); }
.setting-row { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 14px 1px; border-bottom: 1px solid var(--line-soft); }
.setting-row label span { display: block; font-size: 12.5px; font-weight: 600; }.setting-row label small { display: block; color: var(--muted); font-size: 9.5px; margin-top: 1px; }
.setting-row output { color: var(--accent); font: 700 16px/1 var(--mono); }
.setting-row input { grid-column: 1/-1; width: 100%; accent-color: var(--accent); cursor: pointer; }
.setting-choice { border: 0; padding: 15px 0 0; }
.setting-choice legend { color: var(--muted); font-size: 10px; margin-bottom: 8px; }
.segmented { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; }
#zone-choice { grid-template-columns: repeat(2,1fr); }
.segmented button { padding: 8px 5px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink-2); background: var(--surface-2); font-size: 10.5px; }
.segmented button.on { color: #10140b; background: var(--accent); border-color: var(--accent); font-weight: 700; }
.training-tip { margin-top: 16px; padding: 12px 14px; background: linear-gradient(120deg, rgba(184,241,60,.08), transparent); border: 1px solid rgba(184,241,60,.14); border-radius: 9px; }
.training-tip b { color: var(--accent); font-size: 10.5px; }.training-tip p { color: var(--ink-2); font-size: 10.5px; margin-top: 4px; line-height: 1.65; }
.ghost-settings.locked { opacity: .45; pointer-events: none; }

.ghost-dialog { position: fixed; inset: 0; z-index: 400; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(6,8,10,.78); backdrop-filter: blur(7px); }
.ghost-dialog.open { display: flex; }
.dialog-card { width: min(500px,100%); max-height: min(700px,90vh); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: 0 24px 70px rgba(0,0,0,.5); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }.dialog-head span { color: var(--accent); font: 600 8px/1 var(--mono); letter-spacing: .2em; }.dialog-head h2 { font-size: 20px; margin-top: 4px; }.dialog-head button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-2); color: var(--ink-2); }
.history-empty { color: var(--muted); text-align: center; padding: 50px 10px; font-size: 12px; }
.history-item { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; border-bottom: 1px solid var(--line-soft); padding: 13px 2px; }.history-item b { font-size: 13px; }.history-item time,.history-item span { color: var(--muted); font-size: 10.5px; }.history-item strong { grid-row: 1/3; grid-column: 2; align-self: center; color: var(--accent); font: 700 16px/1 var(--mono); }
.clear-history { width: 100%; padding: 9px; margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); font-size: 11px; }

@media (max-width: 920px) {
  .ghost-layout { grid-template-columns: 1fr; }
  .ghost-stage { min-height: 630px; }
  .ghost-court { max-height: none; height: 470px; }
  .ghost-settings { display: grid; grid-template-columns: repeat(2,1fr); gap: 0 20px; }
  .settings-title,.training-tip { grid-column: 1/-1; }
}
@media (max-width: 640px) {
  .ghost-page { padding: 17px 12px 42px; }
  .ghost-head { align-items: flex-start; margin-bottom: 14px; }.ghost-head p { font-size: 11.5px; }.ghost-head-actions { flex-direction: column; }.ghost-icon-btn { padding: 7px 9px; }
  .ghost-layout { gap: 12px; }.ghost-stage { min-height: 620px; padding: 10px; }
  .run-stats > div { padding: 8px; flex-direction: column; gap: 3px; }.run-stats b { font-size: 13px; }
  .court-wrap { padding: 10px 0; }.ghost-court { height: min(480px,64vh); }
  .target { width: 60px; }.target b { font-size: 10px; }.target small { font-size: 6px; }
  .ghost-settings { display: block; padding: 17px; }
  .keyboard-hint { display: none; }.ghost-btn { flex: 1; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) { .target.active::after { animation: none; } }
