/* Ride Lab — bicycle physics game (home embed + /ride page) */
.ride { background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow); overflow: hidden; }
.ride-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.ride-bar label { display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; font-weight: 700; color: var(--muted); }
.ride-bar select { padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-size: .88rem; font-weight: 600; color: var(--ink); max-width: 46vw; }
.ride-bar .spacer { flex: 1; }
.ride-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); }
.ride-seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font: inherit; font-size: .85rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.ride-seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.ride-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font: inherit; font-size: .84rem; font-weight: 700; color: var(--ink-2); cursor: pointer; text-decoration: none; white-space: nowrap; }
.ride-btn:hover { border-color: var(--ink); color: var(--ink); }
.ride-btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.ride-btn.accent:hover { background: var(--accent-ink); color: #fff; }
.ride-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.ride-stage { position: relative; aspect-ratio: 16 / 8; min-height: 300px; max-height: 72vh; width: 100%; outline: none; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.ride-stage:focus-visible { box-shadow: inset 0 0 0 3px var(--accent); }
.ride-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }
.ride[data-view="edit"] .ride-stage { cursor: crosshair; aspect-ratio: 16 / 9; }

.ride-touch { position: absolute; inset: auto 0 12px 0; display: none; justify-content: space-between; padding: 0 12px; pointer-events: none; }
.ride-touch div { display: flex; gap: 10px; pointer-events: auto; }
.ride-touch button { width: 58px; height: 58px; border-radius: 50%; border: 1px solid var(--line-2); background: color-mix(in srgb, var(--surface) 78%, transparent); color: var(--ink); font-size: 1.3rem; font-weight: 800; touch-action: none; backdrop-filter: blur(4px); }
.ride-touch button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (pointer: coarse) { .ride-touch { display: flex; } }
.ride[data-view="edit"] .ride-touch { display: none; }

.ride-foot { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); font-size: .84rem; color: var(--muted); }
.ride-foot kbd { font-family: var(--mono); font-size: .76rem; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink-2); }
.ride-keys { display: flex; flex-wrap: wrap; gap: 6px 14px; }

/* editor toolbar */
.ride-tools { display: none; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ride[data-view="edit"] .ride-tools { display: flex; }
.ride[data-view="edit"] .ride-play-only { display: none; }
.ride:not([data-view="edit"]) .ride-edit-only { display: none; }
.ride-tools .grp { display: inline-flex; gap: 4px; padding-right: 8px; margin-right: 2px; border-right: 1px solid var(--line); flex-wrap: wrap; }
.ride-tools .grp:last-child { border-right: 0; }
.ride-tools input[type="text"] { padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-size: .86rem; width: 150px; color: var(--ink); }
.ride-tools label.chk { display: inline-flex; gap: 6px; align-items: center; font-size: .82rem; font-weight: 700; color: var(--ink-2); }
.ride-msg { font-size: .82rem; color: var(--teal); min-height: 1.2em; }
.ride-msg.bad { color: var(--red); }

/* stats */
.ride-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 22px; padding: 14px 16px; border-top: 1px solid var(--line); }
.ride-stats label { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 700; color: var(--ink-2); }
.ride-stats output { font-family: var(--mono); color: var(--accent-ink); }
.ride-stats small { display: block; font-size: .74rem; color: var(--muted); line-height: 1.4; }
@media (max-width: 720px) {
  .ride-stats { grid-template-columns: 1fr; }
  .ride-stage { aspect-ratio: 4 / 3.4; }
  .ride-bar label { flex: 1 1 100%; justify-content: space-between; }
  .ride-bar select { flex: 1; max-width: none; }
  .ride-bar .spacer { display: none; }
}

/* home section */
.ride-home-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.ride-home-head .section-head { margin-bottom: 0; }
.ride-pill { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; color: var(--accent); font-weight: 700; text-transform: uppercase; }
.ride-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: pulse 2s infinite; }
.ride-features { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
.ride-features div { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: .86rem; color: var(--ink-2); line-height: 1.5; }
.ride-features strong { display: block; color: var(--ink); font-size: .92rem; margin-bottom: 2px; }
@media (max-width: 860px) { .ride-features { grid-template-columns: 1fr 1fr; } }


/* course picker */
.ride-course { display: inline-flex; align-items: center; gap: 6px; }
.ride-course .ride-btn { padding: 7px 9px; }
.ride-tools select { padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-size: .84rem; color: var(--ink); }
.ride-tools input[type="range"] { width: 90px; }
.rc-tier { font-size: 1rem; margin: 28px 0 12px; display: flex; align-items: center; gap: 10px; }
.rc-tier::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.rc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.rc-card { display: grid; gap: 6px; padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); text-align: left; font: inherit; color: var(--ink); cursor: pointer; transition: border-color .15s, transform .15s; }
.rc-card:hover { border-color: var(--ink); transform: translateY(-2px); }
.rc-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.rc-card canvas { width: 100%; height: auto; aspect-ratio: 240 / 90; border-radius: 6px; background: var(--surface-2); }
.rc-name { font-size: .86rem; font-weight: 700; line-height: 1.35; }
.rc-name b { font-family: var(--mono); color: var(--accent-ink); margin-right: 4px; }
.rc-best { font-family: var(--mono); font-size: .74rem; color: var(--muted); min-height: 1em; }
.rc-card[data-tier="4"] .rc-name b { color: var(--blue); }
.rc-card[data-tier="5"] .rc-name b { color: var(--red); }
@media (max-width: 720px) { .ride-course { flex: 1 1 100%; } .ride-course label { flex: 1; } }
