/* =====================================================================
   GYMKHANA ATTACK — motorsport timing-screen UI
   ===================================================================== */
:root {
  --bg: rgba(12, 13, 17, 0.84);
  --bg-solid: #101116;
  --bg2: rgba(26, 28, 35, 0.92);
  --bg3: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.10);
  --line2: rgba(255, 255, 255, 0.22);
  --fg: #f1f3f6;
  --muted: #8f98a4;
  --acc: #ffc21a;          /* 計時イエロー */
  --acc-dim: rgba(255, 194, 26, 0.14);
  --acc2: #ff4f1f;         /* オレンジ */
  --good: #28e07f;         /* 自己ベスト区間 */
  --bad: #ff4757;
  --blue: #4fc3ff;
  --purple: #b76cff;       /* 全体ベスト */
  --num: 'Barlow Condensed', 'Rajdhani', 'Noto Sans JP', system-ui, sans-serif;
  --jp: 'Noto Sans JP', system-ui, sans-serif;
  --r: 6px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent;
  background: #0a0b0e; color: var(--fg); font-family: var(--jp); -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
.hidden { display: none !important; }
button, select, input, textarea { font: inherit; color: inherit; }
::selection { background: var(--acc); color: #111; }

/* ---------- 基本部品 ---------- */
button {
  position: relative; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: var(--r);
  padding: 8px 14px; cursor: pointer; font-weight: 500; letter-spacing: .02em;
  transition: background .15s, border-color .15s, transform .12s var(--ease), box-shadow .15s;
}
button:hover { background: rgba(255, 255, 255, 0.13); border-color: var(--line2); }
button:active { transform: translateY(1px) scale(.99); }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, .course-item:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
button:disabled { opacity: .35; cursor: default; transform: none; }
button.primary {
  background: linear-gradient(180deg, #ffd24d, var(--acc)); color: #15120a; border-color: var(--acc); font-weight: 800;
  box-shadow: 0 4px 14px rgba(255, 194, 26, .25);
}
button.primary:hover { background: linear-gradient(180deg, #ffdc70, #ffca33); }
button.primary:disabled { box-shadow: none; }
select, input, textarea {
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--line); border-radius: var(--r); padding: 7px 9px;
  transition: border-color .15s;
}
select:hover, input:hover, textarea:hover { border-color: var(--line2); }
select { cursor: pointer; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--acc); vertical-align: middle; }
input[type=range] { accent-color: var(--acc); }
textarea { width: 100%; font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 12px; resize: vertical; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: rgba(0,0,0,.4); padding: 2px 6px; border-radius: 4px; }
h2, h3 { margin: 0; }
h2 { font-weight: 900; letter-spacing: .02em; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; line-height: 1.7; margin-top: 12px; padding: 8px 10px; border-left: 2px solid var(--line2); background: rgba(255,255,255,.025); border-radius: 0 var(--r) var(--r) 0; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.row.end { justify-content: flex-end; }
.row.wrap { flex-wrap: wrap; }
.num, .big-time, .hud-time, #rp-time { font-variant-numeric: tabular-nums; }

/* スクロールバー */
.panel, .course-list, .item-list { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.panel::-webkit-scrollbar, .course-list::-webkit-scrollbar, .item-list::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-thumb, .course-list::-webkit-scrollbar-thumb, .item-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 3px; }

/* ---------- 画面とパネル ---------- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 40%, rgba(5,6,8,.35), rgba(5,6,8,.75)); }
.screen.transparent { background: none; pointer-events: none; }
.screen.transparent > * { pointer-events: auto; }
.panel {
  position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px;
  -webkit-backdrop-filter: blur(12px) saturate(1.2); backdrop-filter: blur(12px) saturate(1.2);
  max-height: 92vh; max-height: 92dvh; overflow: auto; box-shadow: var(--shadow);
}
/* 計時モニター風の上辺アクセント */
.panel::before {
  content: ''; position: absolute; left: 0; top: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, var(--acc) 0 64px, rgba(255,194,26,.35) 64px 72px, transparent 72px);
  border-radius: 10px 10px 0 0; pointer-events: none;
}
.screen:not(.transparent) > .panel, .screen > .title-wrap, .screen.transparent > .panel { animation: panelIn .32s var(--ease) both; }
@keyframes panelIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.panel.wide { width: min(1100px, 96vw); }
.panel.small { width: 320px; }
.panel header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.panel header h2 { flex: 1; font-size: 22px; }
.panel header h3 { flex: 1; }
.back { padding: 6px 12px; font-size: 13px; color: var(--muted); background: transparent; }
.back:hover { color: var(--fg); }

/* ---------- タイトル ---------- */
#scr-title {
  background:
    linear-gradient(90deg, rgba(6,7,9,.92) 0%, rgba(6,7,9,.55) 42%, rgba(6,7,9,0) 70%),
    linear-gradient(0deg, rgba(6,7,9,.6), rgba(6,7,9,0) 30%);
  justify-content: flex-start;
}
.title-wrap { margin-left: calc(7vw + var(--sal)); }
.logo { font-family: var(--num); font-weight: 800; line-height: .82; letter-spacing: .02em; font-style: italic; text-transform: uppercase; position: relative; padding-left: 18px; }
.logo::before { content: ''; position: absolute; left: 0; top: 4%; bottom: 4%; width: 6px; background: linear-gradient(180deg, var(--acc), var(--acc2)); transform: skewX(-12deg); }
.logo .l1 { display: block; font-size: 84px; color: #fff; text-shadow: 0 4px 24px rgba(0,0,0,.5); }
.logo .l2 {
  display: block; font-size: 84px; color: var(--acc);
  background: linear-gradient(90deg, var(--acc), #ff9b1a 70%, var(--acc2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.sub { color: var(--muted); margin: 14px 0 26px 18px; letter-spacing: .35em; font-size: 13px; font-weight: 700; }
.menu { display: flex; flex-direction: column; gap: 6px; width: 340px; }
.menu button {
  text-align: left; padding: 11px 16px 11px 20px; font-size: 16px; font-weight: 700; background: rgba(10,11,14,.62);
  border-color: rgba(255,255,255,.08); overflow: hidden;
}
.menu button::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--line2); transition: width .2s var(--ease), background .2s; }
.menu button:hover { background: rgba(20,22,27,.85); transform: translateX(4px); }
.menu button:hover::before { background: var(--acc); width: 5px; }
.menu button small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 1px; }
.menu button.big { background: linear-gradient(90deg, rgba(255,194,26,.2), rgba(10,11,14,.62) 70%); border-color: rgba(255,194,26,.55); font-size: 18px; }
.menu button.big::before { background: var(--acc); width: 5px; }
#scr-title .menu button { animation: menuIn .4s var(--ease) both; }
#scr-title .menu button:nth-child(2) { animation-delay: .04s; } #scr-title .menu button:nth-child(3) { animation-delay: .08s; }
#scr-title .menu button:nth-child(4) { animation-delay: .12s; } #scr-title .menu button:nth-child(5) { animation-delay: .16s; }
#scr-title .menu button:nth-child(6) { animation-delay: .2s; } #scr-title .menu button:nth-child(7) { animation-delay: .24s; }
#scr-title .menu button:nth-child(8) { animation-delay: .28s; }
@keyframes menuIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
.title-foot { margin: 18px 0 0 2px; font-size: 11px; color: rgba(255,255,255,.4); letter-spacing: .08em; }
.title-foot b { color: var(--acc); font-family: var(--num); font-weight: 700; letter-spacing: .12em; }

/* ---------- コース選択 ---------- */
.tabs { display: flex; gap: 0; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: none; border-radius: 0; padding: 9px 16px; color: var(--muted); font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--fg); background: rgba(255,255,255,.04); }
.tabs button.on { color: var(--acc); border-bottom-color: var(--acc); background: linear-gradient(0deg, var(--acc-dim), transparent); }
.mode-tag { background: var(--acc2); color: #fff; font-size: 12px; font-weight: 800; padding: 4px 12px; border-radius: 3px; transform: skewX(-10deg); letter-spacing: .05em; }
.course-body { display: grid; grid-template-columns: 1fr 580px; gap: 18px; }
.course-list { display: flex; flex-direction: column; gap: 6px; max-height: 62vh; overflow: auto; padding-right: 4px; }
.course-item {
  position: relative; padding: 10px 12px 10px 16px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; background: var(--bg3);
  transition: background .15s, border-color .15s, transform .15s var(--ease);
}
.course-item::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: transparent; transition: background .15s; }
.course-item:hover { background: rgba(255,255,255,.09); }
.course-item.on { border-color: rgba(255,194,26,.7); background: var(--acc-dim); }
.course-item.on::before { background: var(--acc); }
.course-item b { display: block; font-size: 15px; }
.course-item .muted { font-size: 12px; }
.course-item .ops { display: flex; gap: 6px; margin-top: 8px; }
.course-item .ops button { padding: 4px 9px; font-size: 12px; }
.course-preview { min-width: 0; }
#course-canvas { width: 100%; height: auto; border-radius: var(--r); background: #16181d; border: 1px solid var(--line); display: block; }
#course-info { font-size: 13px; margin-top: 10px; line-height: 1.7; }
#course-info b { font-size: 15px; }
.stars { color: var(--acc); letter-spacing: 1px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 700; }
.code-box { font-family: ui-monospace, Menlo, monospace; font-size: 11px; word-break: break-all; background: rgba(0,0,0,.45); padding: 10px; border-radius: var(--r); border: 1px dashed var(--line2); max-height: 90px; overflow: auto; user-select: all; -webkit-user-select: all; }

/* ---------- 車両選択 ---------- */
#scr-car { justify-content: space-between; align-items: stretch; padding: calc(3vh + var(--sat)) calc(2vw + var(--sar)) calc(3vh + var(--sab)) calc(2vw + var(--sal)); }
.car-left { width: 300px; }
.car-right { width: 370px; align-self: flex-end; }
#car-list { display: flex; flex-direction: column; gap: 5px; }
.car-item {
  position: relative; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--bg3); transition: background .15s, border-color .15s;
  line-height: 1.3;
}
.car-item:hover { background: rgba(255,255,255,.09); }
.car-item.on { border-color: rgba(255,194,26,.7); background: var(--acc-dim); box-shadow: inset 3px 0 0 var(--acc); }
.car-item small { font-size: 10px; letter-spacing: .12em; }
.drv { font-family: var(--num); font-weight: 700; font-size: 13px; padding: 1px 8px; border-radius: 3px; background: #333; letter-spacing: .04em; color: #fff; white-space: nowrap; }
.drv.FF { background: #2c6bd6; } .drv.FR { background: #d63a2c; } .drv.MR { background: #9b3bd6; } .drv.RR { background: #d68a2c; } .drv[class~="4WD"] { background: #2c9d5c; }
#car-name { font-family: var(--num); font-size: 38px; font-weight: 800; font-style: italic; line-height: 1; text-transform: uppercase; letter-spacing: .01em; }
#car-name small { font-style: normal; letter-spacing: .2em; text-transform: uppercase; }
#car-model { font-size: 12px; margin-top: 4px; }
#car-desc { font-size: 13px; line-height: 1.75; color: #cfd4da; }
.specs { display: grid; grid-template-columns: auto 1fr; gap: 0; font-size: 13px; border-top: 1px solid var(--line); }
.specs > span { padding: 6px 0; border-bottom: 1px solid var(--line); }
.specs .k { color: var(--muted); font-size: 12px; padding-right: 14px; }
.bar { height: 5px; background: rgba(255,255,255,.1); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--acc), var(--acc2)); border-radius: 3px; }
.colors { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.colors span { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); cursor: pointer; transition: transform .15s var(--ease); box-shadow: inset 0 -6px 10px rgba(0,0,0,.25); }
.colors span:hover { transform: scale(1.1); }
.colors span.on { border-color: #fff; box-shadow: 0 0 0 2px var(--acc), inset 0 -6px 10px rgba(0,0,0,.25); }
.car-right .row:last-child { margin-top: 16px; }
.car-right .row:last-child button { flex: 1; padding: 11px 14px; }
#car-go { font-size: 17px; }

/* ---------- セッティング ---------- */
#scr-setup { justify-content: flex-end; }
.setup-panel { width: min(560px, 96vw); height: 96vh; height: 96dvh; margin-right: 2vw; }
.setup-panel header { position: sticky; top: -18px; z-index: 2; background: var(--bg-solid); margin: -18px -20px 12px; padding: 16px 20px 12px; }
.setup-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.setup-tools button { font-size: 13px; }
.setup-tools input { flex: 1; min-width: 120px; }
.setup-fields h4 { margin: 18px 0 6px; color: var(--acc); font-size: 12px; letter-spacing: .12em; border-bottom: 1px solid var(--line); padding-bottom: 5px; font-weight: 900; }
.sf { display: grid; grid-template-columns: 170px 1fr 74px; gap: 10px; align-items: center; font-size: 13px; padding: 4px 6px; margin: 1px -6px; border-radius: 4px; }
.sf:hover { background: rgba(255,255,255,.035); }
.sf input[type=range] { width: 100%; accent-color: var(--acc); }
.sf .v { font-family: var(--num); font-size: 17px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.sf.changed label { color: var(--acc); }
.sf.changed label::before { content: '● '; font-size: 8px; vertical-align: middle; }
.sf.changed .v { color: var(--acc); }

/* =====================================================================
   走行 HUD
   ===================================================================== */
#hud, #walk-hud { position: fixed; inset: 0; pointer-events: none; }
.hud-top {
  position: absolute; top: calc(12px + var(--sat)); left: 50%; transform: translateX(-50%); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.hud-att {
  font-family: var(--num); font-weight: 800; font-style: italic; letter-spacing: .18em; color: #15120a; font-size: 15px;
  background: var(--acc); padding: 1px 14px 0; transform: skewX(-12deg); border-radius: 2px; line-height: 1.35;
}
.hud-time {
  font-family: var(--num); font-weight: 700; font-size: 58px; line-height: 1; letter-spacing: .01em;
  background: linear-gradient(180deg, rgba(10,11,14,.78), rgba(10,11,14,.62)); padding: 3px 18px 2px; border-radius: 6px;
  border-bottom: 3px solid var(--acc); min-width: 5.2em; text-shadow: 0 2px 8px rgba(0,0,0,.6);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.hud-pen {
  color: #fff; font-weight: 900; font-size: 13px; background: var(--bad); padding: 2px 10px; border-radius: 3px; letter-spacing: .04em;
  box-shadow: 0 2px 10px rgba(255,71,87,.35); animation: penIn .3s var(--ease);
}
.hud-pen:empty, .hud-best:empty { display: none; }
@keyframes penIn { from { transform: scale(1.3); opacity: 0; } to { transform: none; opacity: 1; } }
.hud-best { color: #d6dbe1; font-family: var(--num); font-weight: 700; font-size: 15px; letter-spacing: .06em; background: rgba(10,11,14,.55); padding: 1px 10px; border-radius: 3px; font-variant-numeric: tabular-nums; }
/* 計時ブロック: タイム右に BEST との差 */
.hud-timebox { position: relative; }
.hud-time.live { animation: timeLive .5s var(--ease); }
@keyframes timeLive { 0% { border-bottom-color: var(--good); box-shadow: 0 0 18px rgba(40,224,127,.55); } 100% { border-bottom-color: var(--acc); box-shadow: none; } }
.hud-delta {
  position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%); white-space: nowrap;
  font-family: var(--num); font-weight: 800; font-size: 30px; line-height: 1; padding: 3px 9px 2px; border-radius: 4px;
  background: rgba(10,11,14,.72); font-variant-numeric: tabular-nums; text-shadow: 0 1px 4px rgba(0,0,0,.6); opacity: 0;
}
.hud-delta:empty { display: none; }
.hud-delta small { display: block; font-size: 10px; letter-spacing: .12em; color: var(--muted); font-weight: 700; margin-bottom: 1px; }
.hud-delta.show { opacity: 1; animation: deltaIn .45s var(--ease); }
.hud-delta.good { color: var(--good); box-shadow: inset 0 -2px 0 var(--good); }
.hud-delta.bad { color: var(--bad); box-shadow: inset 0 -2px 0 var(--bad); }
.hud-delta.even { color: #fff; }
@keyframes deltaIn { 0% { opacity: 0; transform: translate(-6px, -50%) scale(1.25); } 100% { opacity: 1; transform: translate(0, -50%); } }
/* スタート信号 */
.hud-lamps {
  position: absolute; top: 27%; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: opacity .25s, transform .25s var(--ease);
}
.hud-lamps.out { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(.92); }
.hud-lamps .lamps { display: flex; gap: 12px; padding: 10px 14px; background: rgba(8,9,11,.82); border-radius: 12px; border: 1px solid rgba(255,255,255,.14); box-shadow: var(--shadow); }
.hud-lamps .lamps i {
  width: 38px; height: 38px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #3a2a2c, #1a1213 70%);
  box-shadow: inset 0 -3px 6px rgba(0,0,0,.6); transition: background .08s, box-shadow .08s;
}
.hud-lamps .lamps i.r { background: radial-gradient(circle at 40% 35%, #ffb3b8, #ff2d3d 55%, #b3101d); box-shadow: 0 0 18px rgba(255,45,61,.8), inset 0 -3px 6px rgba(0,0,0,.3); }
.hud-lamps .lamps i.g { background: radial-gradient(circle at 40% 35%, #c8ffe0, #22e57a 55%, #0d9a4b); box-shadow: 0 0 22px rgba(34,229,122,.9), inset 0 -3px 6px rgba(0,0,0,.3); }
.lamp-txt { font-family: var(--num); font-weight: 800; font-style: italic; font-size: 34px; letter-spacing: .12em; line-height: 1; text-shadow: 0 3px 12px rgba(0,0,0,.8); text-align: center; }
.hud-lamps.go .lamp-txt { color: var(--good); font-size: 46px; }
.lamp-txt small { display: block; font-family: var(--jp); font-style: normal; font-size: 13px; letter-spacing: .04em; color: #fff; font-weight: 700; margin-top: 6px; background: rgba(10,11,14,.7); padding: 4px 10px; border-radius: 4px; }
/* ビギナー向けヒント */
.hud-tip {
  position: absolute; top: calc(118px + var(--sat)); left: calc(16px + var(--sal)); max-width: 340px; z-index: 6; pointer-events: auto;
  display: flex; gap: 10px; align-items: flex-start; padding: 9px 8px 9px 11px; border-radius: var(--r);
  background: rgba(12,14,20,.9); border: 1px solid rgba(79,195,255,.45); border-left: 3px solid var(--blue); box-shadow: var(--shadow);
  font-size: 13px; line-height: 1.5; animation: tipIn .35s var(--ease);
}
.hud-tip b { display: block; color: var(--blue); font-size: 11px; letter-spacing: .1em; margin-bottom: 1px; }
.hud-tip .tip-ic { flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--blue); color: #08131b; font-weight: 900; font-size: 13px; display: flex; align-items: center; justify-content: center; margin-top: 2px; }
.hud-tip #tip-body { flex: 1; }
.hud-tip button { flex: none; padding: 2px 8px; font-size: 13px; background: transparent; border-color: transparent; color: var(--muted); }
@keyframes tipIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.hud-next {
  position: absolute; top: calc(14px + var(--sat)); left: calc(16px + var(--sal)); background: var(--bg); border-radius: var(--r); padding: 8px 14px 8px 12px;
  font-size: 14px; border: 1px solid var(--line); border-left: 3px solid var(--acc); max-width: 300px; line-height: 1.4;
  box-shadow: var(--shadow); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.hud-next:empty { display: none; }
.hud-next .nx-num, .hud-next .nx-main, .hud-next .nx-sub { display: none; }
body.touch .hud-next .nx-full { display: none; }
.hud-next b { display: inline-block; min-width: 24px; text-align: center; background: var(--acc); color: #15120a; font-family: var(--num); font-weight: 800; border-radius: 3px; padding: 0 5px; margin: 0 4px; }
.hud-next .p { height: 4px; background: rgba(255,255,255,.14); margin-top: 7px; border-radius: 2px; overflow: hidden; }
.hud-next .p i { display: block; height: 100%; background: linear-gradient(90deg, var(--acc), var(--good)); border-radius: 2px; }
.hud-msg {
  position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); font-family: var(--num); font-weight: 800; font-style: italic;
  font-size: 76px; letter-spacing: .02em; text-shadow: 0 4px 18px rgba(0,0,0,.85), 0 0 2px rgba(0,0,0,.8); text-align: center; white-space: pre-line; line-height: 1;
  width: max-content; max-width: 94vw;
}
.hud-msg:not(:empty) { animation: msgIn .38s var(--ease); }
@keyframes msgIn { from { opacity: 0; transform: translate(-50%, -50%) scale(1.25); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.hud-msg small {
  display: block; font-size: 17px; font-family: var(--jp); font-style: normal; font-weight: 700; margin-top: 10px; letter-spacing: .04em;
  background: rgba(10,11,14,.7); padding: 5px 14px; border-radius: 4px; width: max-content; max-width: 90vw; margin-left: auto; margin-right: auto;
}
#minimap {
  position: absolute; right: calc(16px + var(--sar)); top: calc(14px + var(--sat)); width: 190px; height: 190px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.18); background: rgba(10,11,14,.45); box-shadow: 0 0 0 4px rgba(10,11,14,.35), var(--shadow);
}

/* メーター（ダッシュボード） */
.hud-meter {
  position: absolute; right: calc(16px + var(--sar)); bottom: calc(16px + var(--sab)); width: 300px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px 10px; box-shadow: var(--shadow); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.rpm { position: relative; height: 14px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; }
.rpm-bar { height: 100%; width: 0; background: linear-gradient(90deg, #28e07f 0%, #9be22b 45%, var(--acc) 68%, #ff7a1a 84%, var(--bad) 100%); background-size: 300px 100%; }
.rpm-red { position: absolute; top: 0; bottom: 0; right: 0; background: repeating-linear-gradient(135deg, rgba(255,71,87,.45) 0 4px, rgba(255,71,87,.2) 4px 8px); }
/* LED セグメント風の区切り */
.rpm::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 9px, rgba(10,11,14,.9) 9px 11px); pointer-events: none; }
.meter-row { display: flex; align-items: flex-end; gap: 12px; margin-top: 6px; }
.gear {
  font-family: var(--num); font-weight: 800; font-size: 54px; line-height: 1; color: var(--acc); width: 50px; height: 56px; text-align: center;
  background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 5px; padding-top: 2px;
}
.spd { font-family: var(--num); font-weight: 700; font-size: 50px; line-height: .9; font-variant-numeric: tabular-nums; flex: 1; text-align: right; }
.spd small { font-size: 13px; margin-left: 4px; color: var(--muted); letter-spacing: .08em; font-weight: 600; }
.inputs { display: flex; gap: 6px; align-items: flex-end; margin-top: 8px; }
.ib { width: 34px; text-align: center; font-size: 9px; color: var(--muted); font-family: var(--num); font-weight: 700; letter-spacing: .08em; }
.ib i { display: block; height: 36px; background: rgba(255,255,255,.07); border-radius: 3px; position: relative; overflow: hidden; margin-bottom: 2px; }
.ib i::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: var(--v, 0%); background: linear-gradient(0deg, #1fb866, var(--good)); }
.ib i.b::after { background: linear-gradient(0deg, #d62f3f, var(--bad)); } .ib i.h::after { background: linear-gradient(0deg, #2a9fd8, var(--blue)); }
.steer { flex: 1; height: 8px; background: rgba(255,255,255,.08); border-radius: 4px; position: relative; margin-bottom: 15px; }
.steer::before { content: ''; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: rgba(255,255,255,.3); }
.steer i { position: absolute; top: -3px; width: 6px; height: 14px; background: #fff; border-radius: 3px; left: calc(50% - 3px); box-shadow: 0 0 6px rgba(255,255,255,.6); }
#gmeter { position: absolute; left: -84px; bottom: 0; width: 70px; height: 70px; background: rgba(10,11,14,.45); border-radius: 50%; }
.hud-cam { position: absolute; left: calc(16px + var(--sal)); bottom: calc(16px + var(--sab)); color: var(--muted); font-size: 12px; background: var(--bg); padding: 6px 10px; border-radius: var(--r); border: 1px solid var(--line); }
.hud-cam:empty { display: none; }
.walk-help { position: absolute; bottom: calc(20px + var(--sab)); left: 50%; transform: translateX(-50%); background: var(--bg); padding: 9px 16px; border-radius: var(--r); font-size: 13px; border: 1px solid var(--line); white-space: nowrap; max-width: 96vw; overflow: hidden; text-overflow: ellipsis; }
.walk-help b { color: var(--acc); }
.crosshair { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: rgba(255,255,255,.75); font-size: 20px; text-shadow: 0 0 4px rgba(0,0,0,.8); }

/* 大きなコース図 */
#map-overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.55); pointer-events: auto; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
#map-overlay .panel { display: flex; gap: 14px; animation: panelIn .25s var(--ease) both; }
#bigmap { width: min(900px, 70vw); height: auto; border-radius: var(--r); }
.item-list { font-size: 12px; min-width: 200px; max-height: 70vh; overflow: auto; }
.item-list div { padding: 4px 8px; border-radius: 4px; border-left: 2px solid transparent; }
.item-list div.on { background: var(--acc-dim); color: var(--acc); border-left-color: var(--acc); font-weight: 700; }
.item-list div.done { color: var(--muted); text-decoration: line-through; opacity: .7; }

/* ---------- 結果 ---------- */
.result-panel { width: min(660px, 94vw); }
.result-panel h2 { font-family: var(--num); font-size: 26px; font-weight: 800; letter-spacing: .08em; font-style: italic; text-transform: uppercase; }
#res-body > .muted:first-child { margin-top: 8px; font-size: 12px; letter-spacing: .1em; }
.big-time {
  font-family: var(--num); font-weight: 800; font-size: 76px; line-height: 1.05; letter-spacing: .01em;
  background: linear-gradient(180deg, #fff 30%, #c9ced6); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: timeIn .5s var(--ease) both;
}
.big-time.mc { background: none; -webkit-text-fill-color: var(--bad); color: var(--bad); }
@keyframes timeIn { from { opacity: 0; transform: translateY(8px); letter-spacing: .12em; } to { opacity: 1; transform: none; } }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 14px; }
.tbl th, .tbl td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl th { color: var(--muted); font-weight: 700; font-size: 11px; letter-spacing: .08em; background: rgba(255,255,255,.03); }
.tbl tr:nth-child(odd) td { background: rgba(255,255,255,.015); }
.tbl td.num { font-family: var(--num); font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tbl tr.best td { color: var(--acc); background: var(--acc-dim); }
.tbl tr.best td:first-child { box-shadow: inset 3px 0 0 var(--acc); }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 3px; background: #3a3d45; font-weight: 700; vertical-align: middle; }
.tag.new { background: var(--purple); color: #fff; font-family: var(--num); letter-spacing: .08em; }
#res-buttons { margin-top: 16px; }
#res-buttons kbd { font-family: var(--num); font-size: 11px; font-weight: 700; padding: 0 5px; border-radius: 3px; background: rgba(0,0,0,.18); margin-left: 6px; }
#res-buttons button.primary { font-size: 16px; padding: 11px 18px; }
.res-banner {
  position: relative; overflow: hidden; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 10px 0 2px; padding: 8px 14px;
  border-radius: 6px; font-family: var(--num); animation: bannerIn .6s var(--ease) both;
}
.res-banner b { font-size: 30px; font-weight: 800; font-style: italic; letter-spacing: .08em; line-height: 1; }
.res-banner span { font-family: var(--jp); font-weight: 700; font-size: 14px; }
.res-banner.rec { background: linear-gradient(90deg, rgba(183,108,255,.4), rgba(183,108,255,.08)); border: 1px solid var(--purple); color: #fff; }
.res-banner.rec b { color: #e3c8ff; }
.res-banner.pb { background: linear-gradient(90deg, rgba(40,224,127,.32), rgba(40,224,127,.06)); border: 1px solid var(--good); }
.res-banner.pb b { color: var(--good); }
.res-banner.first { background: linear-gradient(90deg, var(--acc-dim), transparent); border: 1px solid rgba(255,194,26,.5); }
.res-banner.first b { color: var(--acc); }
.res-banner::after { content: ''; position: absolute; top: 0; bottom: 0; width: 40%; left: -50%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent); animation: shine 1.6s .5s var(--ease) 2; }
@keyframes shine { to { left: 120%; } }
@keyframes bannerIn { from { opacity: 0; transform: translateX(-16px) skewX(-8deg); } to { opacity: 1; transform: none; } }
.result-panel.celebrate { border-color: rgba(40,224,127,.5); box-shadow: 0 0 0 1px rgba(40,224,127,.25), 0 0 40px rgba(40,224,127,.18), var(--shadow); }
.result-panel.celebrate .big-time { background: linear-gradient(180deg, #fff 20%, #9ff5c4); -webkit-background-clip: text; background-clip: text; }
.dl { font-family: var(--num); font-weight: 700; font-size: 15px; }
.good { color: var(--good); } .bad { color: var(--bad); } .even { color: #d6dbe1; }
.res-speed { display: flex; gap: 10px; margin-top: 14px; }
.res-speed > div { flex: 1; background: var(--bg3); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 10px; display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap; }
.res-speed span { font-size: 11px; color: var(--muted); font-weight: 700; width: 100%; }
.res-speed b { font-family: var(--num); font-size: 26px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.res-speed small { font-size: 11px; color: var(--muted); }
.res-speed em { font-style: normal; font-family: var(--num); font-weight: 700; font-size: 15px; margin-left: auto; }
#res-spd { width: 100%; height: 74px; display: block; margin-top: 8px; background: rgba(0,0,0,.25); border-radius: var(--r); }
.res-legend { font-size: 11px; margin-top: 3px; display: flex; align-items: center; gap: 5px; }
.res-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-left: 4px; }
.res-legend i.me { background: var(--acc); } .res-legend i.rf { background: rgba(160,190,255,.85); }
.res-sec { margin-top: 14px; }
.res-sec-h { font-size: 13px; font-weight: 700; cursor: pointer; list-style: none; padding: 6px 0; }
.res-sec-h::-webkit-details-marker { display: none; }
.res-sec-h::before { content: '▸ '; color: var(--acc); }
.res-sec[open] .res-sec-h::before { content: '▾ '; }
.res-sec-h .muted { font-weight: 400; font-size: 12px; }
.res-sec-wrap { overflow-x: auto; }
.tbl.sec { margin-top: 6px; font-size: 13px; }
.tbl.sec td, .tbl.sec th { padding: 4px 7px; white-space: nowrap; }
.tbl.sec td.num { font-size: 16px; text-align: right; }
.tbl.sec th:nth-child(n+3) { text-align: right; }
.tbl.sec td.c-no { color: var(--muted); font-family: var(--num); font-weight: 700; width: 1%; }
.tbl.sec td.c-it { font-family: var(--num); font-weight: 700; color: #cfd4da; }
.tbl.sec td.d.good { color: var(--good); } .tbl.sec td.d.bad { color: var(--bad); }
.tbl.sec td.c-ref { color: var(--muted); }

#res-buttons button.primary { order: -1; }

/* ---------- ポーズ ---------- */
#scr-pause { background: rgba(5,6,8,.6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
#scr-pause h2 { font-family: var(--num); font-size: 40px; font-weight: 800; font-style: italic; letter-spacing: .15em; margin-bottom: 14px; }
#scr-pause .menu { width: 100%; }
#scr-pause .menu button { padding: 12px 16px; }

/* ---------- リプレイ ---------- */
#scr-replay { position: fixed; inset: 0; pointer-events: none; }
#scr-replay > * { pointer-events: auto; }
.rp-top { position: absolute; top: calc(12px + var(--sat)); left: calc(12px + var(--sal)); width: 380px; max-height: 60vh; padding: 12px 14px; }
.rp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.rp-head h3 { font-size: 15px; }
.rp-head button { padding: 5px 10px; font-size: 13px; }
#rp-toggles label { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 0; cursor: pointer; }
#rp-toggles .sw { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
#rp-splits { margin-top: 8px; }
#rp-splits table { font-size: 12px; border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
#rp-splits td, #rp-splits th { padding: 3px 5px; border-bottom: 1px solid var(--line); }
#rp-splits th { color: var(--muted); font-weight: 700; font-size: 11px; }
#rp-splits td.fast { color: var(--good); font-weight: 700; }
#rp-map { position: absolute; top: calc(12px + var(--sat)); right: calc(12px + var(--sar)); width: 260px; height: 190px; border-radius: 10px; border: 1px solid var(--line); background: rgba(10,11,14,.6); }
.rp-bottom { position: absolute; left: calc(12px + var(--sal)); right: calc(12px + var(--sar)); bottom: calc(12px + var(--sab)); padding: 10px 14px; }
#rp-graph { width: 100%; height: 90px; display: block; }
.rp-ctrl { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
#rp-play { width: 44px; font-size: 16px; padding: 6px 0; }
#rp-seek { flex: 1; accent-color: var(--acc); min-width: 120px; }
#rp-time { font-family: var(--num); font-size: 22px; font-weight: 700; width: 70px; text-align: right; }
.rp-head { gap: 6px; }
.rp-head h3 { flex: 1; }
#scr-replay:not(.more) #rp-splits { display: none; }
.rp-bottom { overflow: visible; }
#rp-lower {
  position: absolute; left: 0; bottom: calc(100% + 10px); display: flex; align-items: center; gap: 10px; pointer-events: none;
  background: linear-gradient(90deg, rgba(8,9,11,.9), rgba(8,9,11,.65)); border-left: 4px solid var(--acc); padding: 6px 14px 5px 10px; border-radius: 0 4px 4px 0;
  font-size: 14px; box-shadow: var(--shadow); animation: tipIn .3s var(--ease);
}
#rp-lower .sw { width: 10px; height: 10px; border-radius: 2px; }
#rp-lower .t { font-family: var(--num); font-weight: 700; font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; min-width: 4.6em; }
#rp-lower .k { font-family: var(--num); font-weight: 700; font-size: 18px; color: #cfd4da; font-variant-numeric: tabular-nums; }
#rp-lower .k small { font-size: 10px; color: var(--muted); margin-left: 2px; }

/* ---------- エディタ ---------- */
#scr-editor { position: fixed; inset: 0; background: #111; }
#ed-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.ed-tools { position: absolute; top: 12px; right: 12px; width: 330px; max-height: calc(100vh - 24px); display: flex; flex-direction: column; gap: 8px; }
.ed-tools header { margin-bottom: 4px; }
.ed-toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.ed-toolbar button { font-size: 13px; padding: 7px 8px; }
.ed-toolbar button.on { background: var(--acc); color: #111; border-color: var(--acc); font-weight: 700; }
.ed-props { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.ed-props:empty { display: none; }
#ed-items { max-height: 30vh; }
#ed-items div { cursor: pointer; display: flex; justify-content: space-between; }
#ed-items div:hover { background: rgba(255,255,255,.08); }
.ed-help { position: absolute; left: 12px; bottom: 12px; font-size: 12px; color: var(--muted); background: var(--bg); padding: 8px 12px; border-radius: var(--r); border: 1px solid var(--line); line-height: 1.6; }

/* ---------- モーダル / トースト / ローディング ---------- */
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
#modal .panel { width: min(560px, 94vw); animation: panelIn .25s var(--ease) both; }
#toast {
  position: fixed; bottom: calc(24px + var(--sab)); left: 50%; transform: translate(-50%, 12px); background: var(--acc); color: #15120a; font-weight: 800;
  padding: 10px 18px; border-radius: var(--r); opacity: 0; transition: opacity .25s, transform .25s var(--ease); pointer-events: none; z-index: 60;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); max-width: 92vw; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#loading { position: fixed; inset: 0; background: #0a0b0e; z-index: 100; overflow: hidden; }
/* 読み込み画面 = X のプレビューと同じ絵。横画面は全面、縦画面は全体が見えるよう収めて、余白は同じ絵をぼかして埋める */
#loading::before { content: ''; position: absolute; inset: -40px; background: url(../img/splash.jpg) center / cover no-repeat; filter: blur(22px) brightness(.55); }
#loading .splash { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; object-position: 15% center; }
@media (orientation: portrait) { #loading .splash { object-fit: contain; } }
.splash-load { position: absolute; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); font-family: var(--num); font-weight: 800; font-style: italic; font-size: 18px; letter-spacing: .4em; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.8); }
.splash-load::after { content: ''; display: block; width: 160px; height: 3px; margin: 8px auto 0; background: linear-gradient(90deg, transparent, var(--acc), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: load 1s linear infinite; }
@keyframes load { from { background-position: -100% 0; } to { background-position: 200% 0; } }

/* ---------- オプション ---------- */
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
#opt-fields .field { background: var(--bg3); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin-bottom: 8px; }
#opt-fields .field > div { display: flex; align-items: center; gap: 10px; }
#opt-fields .field input[type=range] { flex: 1; }
#opt-fields .field input:not([type]), #opt-fields .field select { width: 100%; }
#opt-fields .field span { font-family: var(--num); font-weight: 700; font-size: 16px; min-width: 36px; text-align: right; }
.controls-help table { font-size: 13px; border-collapse: collapse; width: 100%; }
.controls-help td { padding: 5px 6px; border-bottom: 1px solid var(--line); }
.controls-help td:first-child { color: var(--acc); white-space: nowrap; font-family: var(--num); font-weight: 700; font-size: 14px; width: 1%; padding-right: 14px; }
.controls-help h3 { margin: 18px 0 6px; font-size: 12px; letter-spacing: .12em; color: var(--muted); }
.controls-help h3:first-child { margin-top: 0; }
.controls-help p { font-size: 13px; line-height: 1.75; color: #c3c9d0; }

@media (max-width: 900px) {
  .course-body { grid-template-columns: 1fr; }
  .opt-grid { grid-template-columns: 1fr; }
  .logo .l1, .logo .l2 { font-size: 56px; }
  #scr-car { flex-direction: column; }
  .car-left, .car-right { width: 100%; }
}

/* =====================================================================
   タッチ操作
   ===================================================================== */
.touch-layer { display: none; }
body.touch[data-phase="attack"] #touch-drive,
body.touch[data-phase="walk"] #touch-walk { display: block; }
.touch-layer { position: fixed; inset: 0; pointer-events: none; touch-action: none; user-select: none; -webkit-user-select: none; z-index: 5; }
.touch-layer * { touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.touch-layer > * { pointer-events: auto; }
.t-hint { position: absolute; bottom: calc(10px + var(--sab)); left: 50%; transform: translateX(-50%); font-size: 11px; color: rgba(255,255,255,.42); white-space: nowrap; pointer-events: none; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.t-steer-zone { position: absolute; left: 0; bottom: 0; width: 44%; height: 58%; }
.t-steer-base {
  position: absolute; left: 50%; top: 62%; width: 160px; height: 56px; margin: -28px 0 0 -80px; border-radius: 28px;
  background: linear-gradient(90deg, rgba(10,11,14,.5), rgba(10,11,14,.28) 50%, rgba(10,11,14,.5)); border: 2px solid rgba(255,255,255,.22); pointer-events: none;
  transition: border-color .12s;
}
.t-steer-base::before { content: ''; position: absolute; left: 50%; top: 8px; bottom: 8px; width: 2px; margin-left: -1px; background: rgba(255,255,255,.25); border-radius: 1px; }
.t-steer-knob {
  position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff, #cfd4da 70%); box-shadow: 0 3px 10px rgba(0,0,0,.55), inset 0 -3px 6px rgba(0,0,0,.2);
}
.t-steer-zone.on .t-steer-base { border-color: var(--acc); }
.t-steer-zone.on .t-steer-knob { background: radial-gradient(circle at 40% 35%, #fff4cf, var(--acc) 75%); }
.t-btn {
  position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 14px;
  background: rgba(10,11,14,.42); border: 2px solid rgba(255,255,255,.26); color: #fff; font-family: var(--num); font-weight: 800; letter-spacing: .06em;
  user-select: none; -webkit-user-select: none; text-shadow: 0 1px 3px rgba(0,0,0,.6); transition: background .08s, border-color .08s, transform .08s;
}
.t-btn b { font-size: 17px; }
.t-btn.on { background: rgba(255,194,26,.55); border-color: var(--acc); transform: scale(.97); }
.t-btn small { font-size: 10px; font-weight: 500; opacity: .75; font-family: var(--jp); letter-spacing: 0; }
/* 横画面: 右下に SIDE | BRAKE | ACC、シフトは BRAKE の上 */
.t-acc {
  right: calc(14px + var(--sar)); bottom: calc(14px + var(--sab)); width: 92px; height: 190px;
  background: linear-gradient(to top, rgba(40,224,127,.5) var(--lvl, 0%), rgba(10,11,14,.42) var(--lvl, 0%));
  border-color: rgba(40,224,127,.55);
}
.t-acc.on { border-color: var(--good); transform: none; }
.t-brk { right: calc(116px + var(--sar)); bottom: calc(14px + var(--sab)); width: 88px; height: 118px; border-color: rgba(255,71,87,.5); }
.t-brk.on { background: rgba(255,71,87,.55); border-color: var(--bad); }
.t-side { right: calc(214px + var(--sar)); bottom: calc(14px + var(--sab)); width: 80px; height: 80px; border-radius: 50%; border-color: rgba(79,195,255,.45); }
.t-side.on { background: rgba(79,195,255,.55); border-color: var(--blue); }
.t-shift { position: absolute; right: calc(116px + var(--sar)); bottom: calc(142px + var(--sab)); display: flex; flex-direction: column; gap: 6px; }
.t-shift .t-btn { position: static; width: 88px; height: 36px; font-size: 12px; border-radius: 10px; font-family: var(--jp); font-weight: 700; }
/* 上端の小アイコン列（一時停止・視点・MAP・R） */
.t-sys { position: absolute; left: calc(8px + var(--sal)); top: calc(8px + var(--sat)); display: flex; gap: 6px; }
.t-sys .t-btn { position: static; min-width: 42px; height: 34px; padding: 0 6px; font-size: 12px; border-radius: 8px; background: rgba(10,11,14,.5); border-width: 1px; }
.t-stick { position: absolute; left: calc(30px + var(--sal)); bottom: calc(30px + var(--sab)); width: 140px; height: 140px; border-radius: 50%; background: rgba(10,11,14,.35); border: 2px solid rgba(255,255,255,.28); }
.t-stick-knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff, #cfd4da 70%); box-shadow: 0 3px 10px rgba(0,0,0,.5); pointer-events: none; }
.t-look-zone { position: absolute; right: 0; top: 0; width: 60%; height: 100%; }
.t-go { right: calc(14px + var(--sar)); bottom: calc(24px + var(--sab)); padding: 12px 18px; font-size: 16px; background: rgba(255,194,26,.7); border-color: var(--acc); color: #15120a; text-shadow: none; }
body.touch .walk-help, body.touch .crosshair, body.touch .hud-cam, body.touch #gmeter { display: none; }
body.touch #minimap { width: 110px; height: 110px; left: calc(8px + var(--sal)); top: calc(50px + var(--sat)); right: auto; }
body.touch .hud-next { top: calc(168px + var(--sat)); left: calc(8px + var(--sal)); font-size: 12px; max-width: 46vw; padding: 6px 10px; }
body.touch .hud-meter { top: calc(8px + var(--sat)); right: calc(8px + var(--sar)); bottom: auto; transform: scale(.66); transform-origin: top right; }
body.touch .hud-time { font-size: 38px; }
body.touch .hud-msg { font-size: 46px; }
body.touch .hud-tip { top: calc(64px + var(--sat)); left: 27vw; right: 27vw; max-width: none; }

/* ---- 横画面スマホ: 計時ブロックを詰め、メッセージは車の上へ ---- */
@media (orientation: landscape) and (max-height: 520px) {
  .hud-top { top: calc(6px + var(--sat)); gap: 2px; }
  .hud-att { font-size: 12px; }
  .hud-time { font-size: 32px; padding: 1px 12px 0; border-bottom-width: 2px; }
  .hud-best, .hud-pen { font-size: 11px; }
  .hud-msg { top: 46%; font-size: 42px; }
  .hud-msg small { font-size: 12px; padding: 3px 10px; margin-top: 6px; }
  body.touch .hud-time { font-size: 30px; }
  body.touch .hud-msg { font-size: 40px; }
  .hud-delta { font-size: 20px; padding: 2px 7px 1px; }
  .hud-delta small { font-size: 8px; }
  .hud-lamps { top: 24%; gap: 5px; }
  .hud-lamps .lamps { gap: 9px; padding: 7px 10px; }
  .hud-lamps .lamps i { width: 26px; height: 26px; }
  .lamp-txt { font-size: 24px; } .hud-lamps.go .lamp-txt { font-size: 30px; }
  .lamp-txt small { font-size: 11px; margin-top: 4px; }
  .hud-tip { top: calc(64px + var(--sat)); left: 26vw; right: 26vw; max-width: none; font-size: 12px; padding: 6px 6px 6px 9px; }
  #rp-lower { font-size: 12px; padding: 4px 10px 3px 8px; }
  #rp-lower .t { font-size: 18px; }
}
/* ---- 縦画面（タッチ）: 下 38% に操作系を集約 ---- */
@media (orientation: portrait) {
  body.touch .t-steer-zone { width: 56%; height: 38%; }
  body.touch .t-steer-base { width: 150px; margin-left: -75px; }
  body.touch .t-acc { right: calc(10px + var(--sar)); bottom: calc(12px + var(--sab)); width: 78px; height: 176px; }
  body.touch .t-brk { right: calc(96px + var(--sar)); bottom: calc(12px + var(--sab)); width: 76px; height: 112px; }
  body.touch .t-side { right: calc(96px + var(--sar)); bottom: calc(132px + var(--sab)); width: 76px; height: 56px; border-radius: 28px; }
  body.touch .t-shift { right: calc(10px + var(--sar)); bottom: calc(196px + var(--sab)); }
  body.touch .t-shift .t-btn { width: 78px; height: 34px; }
  body.touch .hud-top { top: calc(6px + var(--sat)); gap: 2px; }
  body.touch .hud-time { font-size: 32px; padding: 1px 10px 0; border-bottom-width: 2px; }
  body.touch .hud-att { font-size: 11px; padding: 0 10px; }
  body.touch .hud-best { font-size: 11px; }
  body.touch .hud-pen { font-size: 11px; padding: 1px 8px; }
  /* 上段: 計時ブロック / 中段: ミニマップ(左)・メーター(右) / その下: システムボタン・次の指示 */
  body.touch #minimap { width: 80px; height: 80px; top: calc(96px + var(--sat)); }
  body.touch #touch-drive .t-sys, body.touch #touch-walk .t-sys { top: calc(184px + var(--sat)); }
  /* 次の指示はミニマップとメーターの間（上部の計器帯）に収め、前方の視界を空ける */
  body.touch .hud-next {
    top: calc(96px + var(--sat)); left: calc(94px + var(--sal)); right: calc(164px + var(--sar)); transform: none;
    width: auto; max-width: none; min-width: 0;
    padding: 5px 6px 6px; text-align: center; font-size: 11px; line-height: 1.25;
    border-left-width: 1px; border-top: 3px solid var(--acc); background: rgba(10,11,14,.82);
  }
  body.touch .hud-next .nx-num { display: block; font-family: var(--num); font-weight: 800; font-size: 10px; letter-spacing: .12em; color: var(--acc); }
  body.touch .hud-next .nx-main { display: block; font-family: var(--num); font-weight: 800; font-size: 20px; line-height: 1.05; color: #fff; white-space: nowrap; }
  body.touch .hud-next .nx-sub { display: block; font-size: 10px; color: #c9ced6; }
  body.touch .hud-next .p { margin-top: 4px; }
  body.touch .hud-meter { top: calc(96px + var(--sat)); transform: scale(.5); }
  body.touch .hud-msg { font-size: 36px; top: 38%; }
  body.touch .hud-msg small { font-size: 12px; padding: 4px 10px; }
  body.touch .t-stick { left: calc(20px + var(--sal)); bottom: calc(24px + var(--sab)); }
  body.touch .t-look-zone { width: 100%; height: 60%; }
  #map-overlay .panel { flex-direction: column; max-width: 96vw; }
  #bigmap { width: 92vw; }
  .item-list { max-height: 30vh; }
  .rp-top { width: auto; left: 8px; right: 8px; top: calc(8px + var(--sat)); max-height: 42vh; padding: 8px 10px; }
  .rp-head { margin-bottom: 4px; }
  .rp-head button { padding: 4px 9px; font-size: 12px; }
  #rp-toggles { display: flex; flex-wrap: wrap; gap: 2px 12px; }
  #rp-toggles label { font-size: 11px; padding: 2px 0; gap: 5px; }
  #rp-toggles input { width: 16px; height: 16px; }
  #rp-map { top: auto; right: 8px; bottom: calc(176px + var(--sab)); width: 124px; height: 91px; }
  .rp-bottom { left: 6px; right: 6px; bottom: calc(6px + var(--sab)); padding: 8px; }
  #rp-graph { height: 52px; }
  .rp-ctrl { flex-wrap: wrap; gap: 6px; }
  #rp-seek { flex: 1 1 60%; }
  .rp-ctrl select { flex: 1 1 28%; min-width: 0; font-size: 12px; padding: 6px 4px; }
  #rp-lower { font-size: 12px; padding: 4px 10px 3px 8px; max-width: calc(100% - 140px); }
  #rp-lower .t { font-size: 18px; min-width: 4.2em; }
  #rp-lower .k { font-size: 14px; }
  /* 縦画面タッチ: 信号・差分・ヒントを上部の計器帯に収め、中央を空ける */
  body.touch .hud-delta { font-size: 19px; padding: 2px 6px 1px; left: calc(100% + 5px); }
  body.touch .hud-delta small { font-size: 8px; }
  body.touch .hud-lamps { top: calc(298px + var(--sat)); gap: 5px; }
  body.touch .hud-lamps .lamps { gap: 9px; padding: 7px 10px; }
  body.touch .hud-lamps .lamps i { width: 28px; height: 28px; }
  body.touch .lamp-txt { font-size: 24px; } body.touch .hud-lamps.go .lamp-txt { font-size: 30px; }
  body.touch .lamp-txt small { font-size: 11px; margin-top: 4px; }
  body.touch .hud-tip { top: calc(226px + var(--sat)); left: calc(8px + var(--sal)); right: calc(8px + var(--sar)); max-width: none; font-size: 12px; padding: 6px 6px 6px 9px; }
  .result-panel .tbl.sec .c-ref { display: none; }
  .ed-tools { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 46vh; border-radius: 12px 12px 0 0; }
  .result-panel { width: 94vw; }
}
@media (orientation: portrait) and (max-width: 600px) {
  .panel header h2 { font-size: 18px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { font-size: 12px; padding: 8px 10px; flex: 1 0 auto; white-space: nowrap; }
  .panel.wide { width: 96vw; }
  .opt-grid { grid-template-columns: 1fr; }
  .tbl { font-size: 12px; }
  .tbl th, .tbl td { padding: 6px 5px; }
  .tbl td.num { font-size: 15px; }
  .big-time { font-size: 58px; }
  .res-banner b { font-size: 24px; }
  .res-speed b { font-size: 22px; }
  .tbl.sec td.num { font-size: 14px; }
  .tbl.sec td, .tbl.sec th { padding: 4px 4px; }
  .row.wrap button, #res-buttons button { font-size: 13px; padding: 9px 10px; }
  #res-buttons button { flex: 1 1 calc(50% - 8px); }
  #res-buttons button.primary { flex-basis: 100%; }
  /* タイトル: 下寄せで親指の届く位置にメニュー */
  #scr-title { align-items: flex-end; background: linear-gradient(0deg, rgba(6,7,9,.95) 0%, rgba(6,7,9,.7) 55%, rgba(6,7,9,.1) 85%); }
  .title-wrap { margin: 0 auto; width: 100%; padding: 0 16px calc(18px + var(--sab)); }
  .menu { width: 100%; }
  .title-foot { display: none; }
}

/* ================= 小さい画面 ================= */
@media (max-height: 520px), (max-width: 700px) {
  .logo .l1, .logo .l2 { font-size: 44px; }
  .logo { padding-left: 14px; }
  .logo::before { width: 4px; }
  .sub { margin: 8px 0 12px 14px; font-size: 11px; letter-spacing: .25em; }
  .title-wrap { margin-left: calc(4vw + var(--sal)); }
  .menu { width: min(340px, 90vw); gap: 4px; }
  .menu button { padding: 7px 12px 7px 16px; font-size: 14px; }
  .menu button.big { font-size: 15px; }
  .menu button small { font-size: 10px; }
  .title-foot { display: none; }
  .panel { padding: 12px 14px; border-radius: 8px; }
  .panel header { margin-bottom: 8px; padding-bottom: 8px; }
  .panel header h2 { font-size: 18px; }
  .course-body { grid-template-columns: 1fr 1.2fr; gap: 10px; }
  .course-list { max-height: 60vh; }
  #scr-car { padding: 8px calc(8px + var(--sar)) 8px calc(8px + var(--sal)); gap: 8px; flex-direction: row; }
  .car-left { width: 220px; max-height: 94vh; }
  .car-item { padding: 5px 8px; font-size: 12px; }
  .car-right { width: 300px; max-height: 94vh; font-size: 12px; }
  #car-name { font-size: 26px; }
  #car-desc { font-size: 12px; line-height: 1.6; margin: 8px 0; }
  .specs { font-size: 12px; }
  .specs > span { padding: 4px 0; }
  .setup-panel { height: 94vh; width: min(520px, 96vw); margin: 0 auto; }
  .setup-panel header { top: -12px; margin: -12px -14px 10px; padding: 12px 14px 8px; }
  .sf { grid-template-columns: 120px 1fr 60px; font-size: 12px; }
  .big-time { font-size: 50px; }
  .rp-top { width: 250px; max-height: 45vh; font-size: 12px; }
  #rp-map { width: 170px; height: 124px; }
  #rp-graph { height: 50px; }
  .ed-help { display: none; }
  #bigmap { width: min(900px, 62vw); }
}
@media (max-width: 700px) and (orientation: portrait) {
  .course-body { grid-template-columns: 1fr; }
  .course-list { max-height: 34vh; }
  #scr-car { flex-direction: column; justify-content: space-between; }
  .car-left, .car-right { width: 100%; max-height: 45vh; }
  .car-left #car-list { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; scrollbar-width: none; }
  .car-left #car-list::-webkit-scrollbar { display: none; }
  .car-left #car-list .car-item { flex: 0 0 auto; min-width: 150px; }
  .car-left header { margin-bottom: 8px; }
  /* スタートボタンは常に見える位置に */
  .car-right { padding-bottom: 0; }
  .car-right .row:last-child { position: sticky; bottom: 0; z-index: 2; margin: 10px -14px 0; padding: 10px 14px calc(10px + var(--sab)); background: linear-gradient(0deg, var(--bg-solid) 75%, rgba(16,17,22,0)); }
  #car-desc { margin: 6px 0; }
  /* プレビュー: 小さい画面向けの上書きより優先 */
  .rp-top { width: auto; max-height: 42vh; }
  #rp-map { width: 124px; height: 91px; bottom: calc(172px + var(--sab)); }
  #rp-graph { height: 52px; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .ed-tools { width: 250px; font-size: 12px; padding: 10px; }
}

/* =====================================================================
   Round 3: デイリー / 挑戦状 / 共有 / ビギナー / ドリル
   ===================================================================== */
.title-daily { display: flex; gap: 6px; width: 340px; margin-bottom: 8px; }
.title-daily:empty { display: none; }
.title-daily button.daily {
  flex: 1; text-align: left; padding: 9px 12px; background: linear-gradient(135deg, rgba(255,79,31,.32), rgba(10,11,14,.7) 75%);
  border: 1px solid rgba(255,79,31,.6); border-radius: var(--r); position: relative; line-height: 1.25;
}
.title-daily button.daily + button.daily { background: linear-gradient(135deg, rgba(79,195,255,.25), rgba(10,11,14,.7) 75%); border-color: rgba(79,195,255,.5); }
.title-daily button.daily b { display: block; font-size: 15px; font-weight: 900; }
.title-daily button.daily small { display: block; font-size: 11px; color: #c9ced6; margin-top: 2px; }
.title-daily button.daily.done b::after { content: ' ✓'; color: var(--good); }
.title-daily .streak { position: absolute; top: -9px; right: 6px; background: var(--acc2); color: #fff; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 10px; }
.title-prof { margin-top: 10px; width: 340px; }
.title-prof:empty { display: none; }
.title-prof button.prof { width: 100%; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; background: rgba(10,11,14,.55); font-size: 13px; padding: 7px 12px; }
.title-prof .ttl { color: var(--acc); font-weight: 800; font-size: 12px; border: 1px solid rgba(255,194,26,.45); padding: 0 6px; border-radius: 3px; }
.title-prof .muted { font-size: 12px; }
.course-item .cleared { float: right; font-family: var(--num); font-size: 14px; color: var(--good); font-weight: 700; }
.car-item .nick { color: var(--acc); font-size: 11px; letter-spacing: 0; }
.drill-list { max-height: 64vh; }
.course-item .drill-target { display: block; font-size: 11px; color: var(--blue); margin-top: 3px; }

/* ランディング（挑戦状） */
.landing-panel { width: min(600px, 94vw); max-height: 94vh; max-height: 94dvh; overflow: auto; }
.ld-kicker { font-family: var(--num); font-weight: 800; font-style: italic; letter-spacing: .3em; color: var(--acc2); font-size: 14px; }
#ld-title { font-size: 26px; line-height: 1.25; margin: 2px 0 4px; }
#ld-sub { font-size: 13px; margin-bottom: 8px; }
#ld-map { width: auto; max-width: 100%; max-height: 40vh; height: auto; margin: 0 auto; display: block; border-radius: var(--r); background: #16181d; border: 1px solid var(--line); }
.ld-info { margin-top: 10px; font-size: 13px; line-height: 1.6; }
.ld-info p { margin: 6px 0; }
.ld-target { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ld-target span { color: var(--muted); font-size: 12px; font-weight: 700; }
.ld-target b { font-family: var(--num); font-size: 48px; font-weight: 800; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.ld-target small { color: var(--muted); }
.ld-row { display: flex; gap: 6px 14px; flex-wrap: wrap; color: #cfd4da; }
.ld-row .sw, .rival .sw { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; border: 1px solid rgba(255,255,255,.4); }
.ld-msg { font-size: 15px; font-weight: 700; color: #fff; }
#ld-buttons button { flex: 1 1 auto; }
#ld-buttons button.primary { flex-basis: 100%; font-size: 17px; padding: 12px; }

/* ランキング */
.tbl.rank tr.ops-row td { background: none; border-bottom: 1px solid var(--line); padding-top: 0; }
.tbl.rank tr:not(.ops-row) td { border-bottom: none; }
.rk-ops { display: flex; gap: 6px; flex-wrap: wrap; }
.rk-ops button { padding: 4px 9px; font-size: 12px; }
.rank-rivals { margin-top: 16px; }
.rank-rivals h3 { font-size: 13px; letter-spacing: .1em; color: var(--muted); margin-bottom: 6px; }
.rivals { display: flex; flex-wrap: wrap; gap: 6px; }
.rival { display: flex; align-items: baseline; gap: 8px; background: var(--bg3); border: 1px solid var(--line); border-radius: var(--r); padding: 5px 6px 5px 10px; font-size: 13px; }
.rival .wl { font-family: var(--num); font-weight: 700; color: var(--acc); }
.rival button { padding: 1px 7px; font-size: 11px; background: transparent; border-color: transparent; color: var(--muted); }

/* バッジ */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; max-height: 40vh; overflow: auto; }
.badges.new { margin-top: 12px; max-height: none; }
.badge { border: 1px solid var(--line); border-radius: var(--r); padding: 6px 8px; opacity: .45; background: rgba(255,255,255,.02); }
.badge.on { opacity: 1; border-color: rgba(255,194,26,.5); background: var(--acc-dim); }
.badge b { display: block; font-size: 13px; }
.badge small { display: block; font-size: 11px; color: var(--muted); }

/* 結果 */
.res-vs { margin-top: 8px; font-size: 14px; font-weight: 700; }
.res-vs b { font-family: var(--num); font-size: 20px; }
.res-note { margin: 8px 0 0; font-size: 12px; color: var(--acc); background: var(--acc-dim); border-radius: var(--r); padding: 6px 10px; }
.res-advice { margin: 10px 0 0; font-size: 14px; line-height: 1.6; background: rgba(79,195,255,.1); border-left: 3px solid var(--blue); padding: 8px 10px; border-radius: 0 var(--r) var(--r) 0; }
.res-coach { margin-top: 12px; }
.res-coach h4, .res-drill + .coach { margin: 0 0 4px; font-size: 12px; letter-spacing: .1em; color: var(--blue); }
ul.coach { margin: 4px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.65; color: #dfe3e8; }
.res-drill { display: flex; align-items: baseline; gap: 14px; margin-top: 10px; }
.res-drill .stars.big { font-size: 34px; letter-spacing: 2px; }
.res-drill b { font-family: var(--num); font-size: 44px; font-weight: 800; line-height: 1; }
.res-drill b small { font-size: 14px; margin-left: 2px; }
#res-buttons button.share { border-color: rgba(79,195,255,.55); background: rgba(79,195,255,.12); }
#res-buttons button.share:disabled { opacity: .5; }
img.res-card { display: block; width: 100%; max-width: 360px; margin: 0 auto 8px; border-radius: 8px; border: 1px solid var(--line2); -webkit-touch-callout: default; user-select: auto; }
#modal .panel { max-height: 94vh; max-height: 94dvh; overflow: auto; }

/* ルールカード */
.rule-card { text-align: center; padding: 6px 4px 2px; }
.rule-card h4 { font-size: 20px; margin: 10px 0 6px; color: var(--acc); }
.rule-card p { font-size: 14px; line-height: 1.75; margin: 0; color: #e3e6ea; }
.rule-ic { width: 120px; height: 70px; margin: 0 auto; border-radius: 10px; background: #16181d no-repeat center / 100% 100%; border: 1px solid var(--line); }
.rule-ic.route { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 70'%3E%3Cpath d='M10 55 C40 55 40 15 60 15 S80 55 110 55' fill='none' stroke='%23ffc21a' stroke-width='3' stroke-dasharray='6 5'/%3E%3Ccircle cx='60' cy='15' r='6' fill='%23ff7a1a'/%3E%3Ctext x='56' y='40' font-size='12' fill='%23fff' font-family='sans-serif'%3E1%3C/text%3E%3Ccircle cx='108' cy='55' r='5' fill='%23ff7a1a'/%3E%3C/svg%3E"); }
.rule-ic.turn { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 70'%3E%3Ccircle cx='60' cy='35' r='20' fill='none' stroke='%2328e07f' stroke-width='3' stroke-dasharray='5 4'/%3E%3Ccircle cx='60' cy='35' r='6' fill='%23ff7a1a'/%3E%3Cpath d='M82 30 l-4 8 l-6 -6z' fill='%2328e07f'/%3E%3C/svg%3E"); }
.rule-ic.cone { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 70'%3E%3Cpath d='M40 58 L50 20 L56 20 L66 58z' fill='%23ff7a1a'/%3E%3Cpath d='M72 58 L100 46 L100 40 L70 50z' fill='%23ff7a1a' opacity='.8'/%3E%3Ctext x='80' y='30' font-size='16' font-weight='bold' fill='%23ff4757' font-family='sans-serif'%3E+5s%3C/text%3E%3C/svg%3E"); }

/* HUD: 戻れ */
.hud-next.away { border-color: var(--bad) !important; background: rgba(60,10,16,.85) !important; }
.hud-next.away .nx-num, .hud-next.away .nx-full { color: #ffb3b8; }
body.touch .hud-next.away .nx-num { display: block; color: #ff6b78; font-size: 12px; }
/* タッチ: AT のときはシフトボタンを隠す / 「戻る」は練習・ビギナーのみ */
body.at .t-shift { display: none; }
.t-sys .t-ret { display: none; }
body.can-ret .t-sys .t-ret { display: flex; color: #ffd6d9; border-color: rgba(255,71,87,.5); }

@media (max-width: 700px) and (orientation: portrait) {
  .title-daily, .title-prof { width: 100%; }
  .title-daily button.daily { padding: 7px 10px; }
  .title-daily button.daily b { font-size: 14px; }
  #ld-title { font-size: 21px; }
  .ld-target b { font-size: 40px; }
  .landing-panel { padding: 12px 14px; }
}
@media (max-height: 520px), (max-width: 700px) {
  .title-daily { width: min(340px, 90vw); }
  .title-prof { width: min(340px, 90vw); margin-top: 6px; }
  .title-prof button.prof { padding: 5px 10px; }
}
@media (orientation: portrait) and (max-width: 600px) {
  .title-daily, .title-prof { width: 100%; }
}

/* タイトルが画面に収まらないときはスクロール（上端が切れないように） */
#scr-title { overflow-y: auto; }
@media (orientation: landscape) { #scr-title { align-items: safe center; } }
@media (orientation: portrait) and (max-width: 600px) { #scr-title { align-items: safe flex-end; } }
@media (max-height: 520px) and (orientation: landscape) {
  .title-wrap { padding: 8px 0; }
  .sub { display: none; }
  .title-daily, .title-prof { margin-top: 6px; }
}

/* 動きを減らす設定 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .menu button:hover { transform: none; }
}

/* ビギナーのヒントは小さな1〜2行の帯にし、コース前方を隠さない（車の上・操作部の直上に表示） */
.hud-tip { top: auto !important; bottom: calc(150px + var(--sab)) !important; left: 50% !important; right: auto !important; transform: translateX(-50%);
  max-width: min(520px, 86vw) !important; font-size: 12px !important; line-height: 1.35; padding: 5px 10px !important; gap: 6px;
  background: rgba(12,14,20,.72); pointer-events: none !important; animation: none; }
.hud-tip b { display: inline; margin: 0 6px 0 0; font-size: 11px; }
.hud-tip .tip-ic, .hud-tip button { display: none; }
@media (orientation: portrait) { body.touch .hud-tip { bottom: calc(38% + 6px + var(--sab)) !important; max-width: 92vw !important; font-size: 11px !important; } }

.app-ver { display: inline-block; margin-left: 8px; padding: 0 7px; border: 1px solid var(--line); border-radius: 99px; font-family: var(--num); font-size: 12px; letter-spacing: .06em; color: var(--acc); vertical-align: middle; }
.chk-inline { display: inline-flex; align-items: center; gap: 5px; margin-left: 10px; font-size: 13px; white-space: nowrap; cursor: pointer; }
.chk-inline input { accent-color: var(--acc); width: 16px; height: 16px; }
