* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #0b0b0d;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  overflow: hidden;
}

/* Desktop/laptop backdrop so the app reads as "a phone on a screen", never full width */
.backdrop {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 20%, #1a1a1f 0%, #0b0b0d 70%);
  z-index: 0;
}

/* Fixed iPhone-sized frame. Same box on a laptop and on an actual iPhone —
   the viewport meta (width=390) makes real iPhones scale this to fit their screen. */
.phone {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 390px;
  height: 844px;
  max-height: 100vh;
  background: #101013;
  border-radius: 44px;
  border: 6px solid #1c1c1f;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 1;
}

.notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 26px;
  background: #1c1c1f;
  border-radius: 0 0 16px 16px;
  z-index: 5;
}

.app-header {
  padding: 40px 20px 8px;
  text-align: center;
  flex-shrink: 0;
}

.app-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #f5f5f7;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: #8a8a8e;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px 16px 16px;
  min-height: 0;
}

.screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.screen.hidden {
  display: none;
}

.scenario-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 2px;
}

.scenario-card {
  background: #1c1c1f;
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid transparent;
}

.scenario-card:active {
  background: #232326;
}

.scenario-card .title {
  font-size: 15px;
  font-weight: 700;
  color: #f5f5f7;
}

.scenario-card .difficulty {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #34c759;
  margin: 3px 0 6px;
}

.scenario-card .intro {
  font-size: 12px;
  color: #8a8a8e;
  line-height: 1.4;
}

.card-status {
  display: inline-block;
  margin-top: 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 6px;
}

.card-status.held {
  background: #123e1e;
  color: #34c759;
}

.card-status.broken {
  background: #3d1414;
  color: #ff453a;
}

.rating-bar {
  flex-shrink: 0;
  background: #1c1c1f;
  border: 1px solid #2a2a2e;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  color: #c7c7cc;
  text-align: center;
}

.rating-bar.hidden {
  display: none;
}

.rating-bar.complete {
  border-color: #ff9f0a;
  color: #ff9f0a;
}

.scenario-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.back-link {
  background: none;
  border: none;
  color: #8a8a8e;
  font-size: 13px;
  padding: 4px 0;
}

.scenario-name {
  font-size: 13px;
  font-weight: 700;
  color: #f5f5f7;
  flex: 1;
}

.step-indicator {
  font-size: 11px;
  color: #8a8a8e;
}

.pitch-wrap {
  flex: 1;
  min-height: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #163d21;
  border: 1px solid #1f5a2c;
}

#pitch {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.marker.draggable {
  cursor: grab;
}

.marker.draggable:active {
  cursor: grabbing;
}

.step-description {
  flex-shrink: 0;
  margin: 0;
  font-size: 13px;
  color: #c7c7cc;
  line-height: 1.4;
  min-height: 2.6em;
}

.result-banner {
  flex-shrink: 0;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  padding: 16px;
  border-radius: 14px;
}

.result-banner.pass {
  background: #123e1e;
  color: #34c759;
}

.result-banner.fail {
  background: #3d1414;
  color: #ff453a;
}

.result-explanation {
  flex: 1;
  overflow-y: auto;
  margin: 0;
  font-size: 13px;
  color: #c7c7cc;
  line-height: 1.5;
}

.result-actions {
  flex-shrink: 0;
  display: flex;
  gap: 10px;
}

.result-actions .primary-btn {
  flex: 1;
}

.secondary-btn {
  flex: 1;
  background: #1c1c1f;
  color: #f5f5f7;
  border: none;
  border-radius: 14px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
}

.secondary-btn:active {
  background: #2a2a2e;
}

.legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #8a8a8e;
  flex-shrink: 0;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 8px;
}
.dot:first-child { margin-left: 0; }
.dot.def { background: #3b82f6; }
.dot.att { background: #ff453a; }
.dot.ball { background: #f5f5f7; }

.primary-btn {
  flex-shrink: 0;
  background: #34c759;
  color: #04220c;
  border: none;
  border-radius: 14px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
}

.primary-btn:active {
  background: #2ba64c;
}

.primary-btn:disabled {
  opacity: 0.55;
}
