/* Road views share the same coordinates and scroll position. */
#trend { padding: 20px; min-width: 0; }
.road-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.road-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.road-tabs button, .road-options select, .road-latest { border: 1px solid #e2e8f0; border-radius: 10px; background: #edf2f7; color: #536579; padding: 10px 16px; font-size: 14px; cursor: pointer; min-height: 44px; }
.road-tabs button[aria-pressed="true"] { background: #00a8d7; border-color: #00a8d7; color: white; box-shadow: 0 3px 8px #00a8d72a; }
.road-options { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 14px; color: #64748b; }
.road-options select { background: white; padding: 8px; }
.road-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; padding: 10px; background: #f8fafc; border: 1px solid #edf0f4; border-radius: 12px; font-size: 14px; color: #556578; }
.road-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--road-color); margin-right: 5px; }
.road-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between; padding: 14px 0 4px; font-size: 13px; color: #64748b; }
.road-meta strong { color: #334155; }
.road-section { margin-top: 16px; }
.road-section h3 { font-size: 14px; color: #64748b; font-weight: 500; margin: 0 0 8px; }
.road-scroll { overflow: auto; max-height: 340px; background: #fafbfd; border: 1px solid #e9eef4; border-radius: 12px; scrollbar-width: thin; overscroll-behavior-x: contain; }
.road-board { position: relative; min-width: 100%; background-image: linear-gradient(to right, #edf1f666 1px, transparent 1px); background-size: 36px 100%; }
.road-node { position: absolute; width: 26px; height: 26px; display: flex; justify-content: center; align-items: center; font-size: 12px; font-weight: 600; color: #fff; background: var(--road-color); border-radius: 50%; user-select: none; }
.road-node.square { border-radius: 5px; width: 30px; }
.road-node.trial { color: var(--road-color); background: transparent; border: 1px dashed var(--road-color); opacity: .65; }
.road-text .road-node { background: transparent; color: var(--road-color); }
.road-gap { position: absolute; top: 10px; bottom: 10px; width: 30px; border-left: 1px dashed #ccd5df; color: #94a3b8; writing-mode: vertical-rl; font-size: 12px; padding-left: 6px; letter-spacing: 2px; }
.road-note { color: #64748b; font-size: 13px; margin: 14px 0; line-height: 1.7; }
.road-empty { text-align: center; padding: 42px 16px; color: #64748b; }
.road-detail { margin-top: 24px; border-top: 1px solid #e9eef4; padding-top: 14px; }
.road-detail summary { cursor: pointer; color: #536579; font-size: 14px; padding: 8px 0; }
.road-detail-table { overflow-x: auto; }
.road-detail-table > div { min-width: 640px; }
button:focus-visible, select:focus-visible, summary:focus-visible, .road-scroll:focus-visible { outline: 3px solid #38bdf8; outline-offset: 3px; }
/* A compact dialog with a stable scratch surface on mouse, pen, and touch. */
#mipai-modal { padding: 20px; background: #0f172acc; backdrop-filter: blur(8px); }
#mipai-modal .mipai-content { width: min(100%, 560px); height: auto; max-height: calc(100dvh - 40px); overflow-y: auto; padding: 32px 24px 24px; border-radius: 24px; background: linear-gradient(145deg, #2879ee, #164ac1); box-shadow: 0 24px 80px #02061766; animation: none; }
#mipai-modal .mipai-close { width: 38px; height: 38px; top: 14px; right: 14px; font-size: 28px; }
#mipai-modal .mipai-title { font-size: 22px; margin: 12px 28px 20px; }
.mipai-eyebrow { font-size: 13px; color: #dbeafe; letter-spacing: 3px; }
#mipai-modal .mipai-scratch-area { width: 100%; overflow: hidden; border-radius: 16px; isolation: isolate; background: #dce9fb; }
#mipai-modal .mipai-result { max-width: none; width: 100%; min-height: 218px; padding: 30px 12px; border-radius: 16px; }
#mipai-modal .mipai-result-numbers { gap: clamp(5px, 1.5vw, 12px); margin: 22px 0; }
#mipai-modal .mipai-result-numbers span { width: clamp(36px, 10vw, 60px); height: clamp(42px, 11vw, 60px); font-size: 26px; }
#mipai-modal .mipai-result-numbers i { font-size: 18px; }
#mipai-modal .mipai-result-sum { width: clamp(48px, 13vw, 72px) !important; height: clamp(52px, 14vw, 72px) !important; font-size: 32px !important; }
#mipai-modal .mipai-scratch-canvas { width: 100%; height: 100%; touch-action: none; cursor: crosshair; transition: opacity .2s; }
#mipai-modal .mipai-scratch-canvas.revealed { opacity: 0; pointer-events: none; }
.mipai-cover-status { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: #334155; background: #dce9fb; z-index: 2; }
.mipai-cover-status[hidden] { display: none; }
#mipai-modal .mipai-hint { margin-top: 16px; font-size: 14px; min-height: 22px; }
.mipai-progress { width: 100%; height: 5px; margin-top: 12px; border-radius: 6px; overflow: hidden; background: #ffffff30; }
.mipai-progress span { display: block; width: 0; height: 100%; background: #a7f3d0; transition: width .1s; }
.mipai-actions { display: flex; width: 100%; gap: 10px; margin-top: 18px; }
.mipai-actions button { flex: 1; min-height: 44px; border: 1px solid #ffffff55; border-radius: 10px; padding: 10px; font-size: 14px; font-weight: 600; cursor: pointer; background: white; color: #1755c4; }
.mipai-actions button + button { background: #ffffff15; color: white; }
.mipai-actions button:disabled { opacity: .45; cursor: default; }
#mipai-modal .mipai-refresh-time { width: 100%; max-width: none; min-height: 44px; font-size: 14px; cursor: pointer; margin-top: 10px; }
.mipai-timer { margin-top: 18px; color: #dbeafe; font-size: 14px; }
.mipai-timer strong { color: white; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
    #trend { padding: 12px; }
    .road-toolbar { justify-content: center; }
    .road-tabs { width: 100%; gap: 6px; }
    .road-tabs button { flex: 1; padding: 10px 6px; }
    .road-options { width: 100%; justify-content: space-between; gap: 8px; }
    .road-options select { max-width: 130px; }
    .road-latest { padding: 8px; }
    #mipai-modal { padding: 12px; }
    #mipai-modal .mipai-content { padding: 28px 16px 20px; max-height: calc(100dvh - 24px); }
}
@media (prefers-reduced-motion: reduce) {
    #mipai-modal, #mipai-modal *, .road-tabs button { animation: none !important; transition: none !important; }
}

.draw-sync-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin: 12px 0; padding: 12px 16px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; font-size: 13px; color: #64748b; }
#live-status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: #334155; }
#live-status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
#live-status[data-state="live"]::before { background: #10b981; box-shadow: 0 0 0 4px #10b98115; }
#live-status[data-state="offline"]::before { background: #f59e0b; }
#live-synced { font-variant-numeric: tabular-nums; }
.mipai-live-status { color: #dbeafe; font-size: 13px; margin-top: 16px; }
#mipai-modal .mipai-timer { margin-top: 8px; }

#forecast { padding: 16px; }
.double-card { border: 1px solid #dce7f7; background: #f3f8ff; padding: 20px; border-radius: 14px; }
.double-heading { display: flex; justify-content: space-between; gap: 8px; color: #334155; font-weight: 600; font-size: 14px; }
.double-wait { color: #2478da; font-weight: 400; }
.double-picks { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 24px 0; }
.double-badge { font-size: 24px; font-weight: 700; color: white; padding: 12px 24px; border-radius: 12px; }
.double-0 { background: #f97316; }.double-1 { background: #f43f50; }.double-2 { background: #2f80ed; }.double-3 { background: #10b981; }
.double-plus { color: #94a3b8; }.double-empty { color: #64748b; font-size: 16px; }
.double-card p, .double-note { font-size: 13px; color: #64748b; line-height: 1.8; }
.double-card p { text-align: center; margin: 0; }
.double-summary { display: grid; grid-template-columns: repeat(3, 1fr); margin: 18px 0; gap: 8px; }
.double-summary div { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; background: #f8fafc; border-radius: 10px; }
.double-summary strong { color: #334155; font-size: 22px; }.double-summary span { color: #64748b; font-size: 12px; text-align: center; }
.double-note { margin-bottom: 16px; }
.double-row, .double-table-head { display: grid; grid-template-columns: 1fr 1fr 1.5fr .6fr; align-items: center; gap: 6px; padding: 12px 4px; text-align: center; font-size: 14px; color: #475569; border-bottom: 1px solid #edf2f7; }
.double-table-head { background: #f8fafc; color: #64748b; }.double-row small { display: block; font-size: 12px; color: #94a3b8; }
.double-hit.hit { color: #059669; }.double-hit.miss { color: #e15464; }
@media(max-width:480px) { #forecast { padding: 10px; }.double-card { padding: 14px 10px; }.double-badge { font-size: 22px; padding: 12px 20px; }.double-row, .double-table-head { font-size: 12px; }.double-row-pairs { font-size: 13px; } }

#mipai-modal .scratch-number { position: relative; flex: 0 0 auto; display: inline-flex; border-radius: 12px; overflow: hidden; }
#mipai-modal .scratch-number .mipai-scratch-canvas { inset: 0; border-radius: 12px; }
#mipai-modal .scratch-number .mipai-scratch-canvas:focus-visible { outline: 3px solid #1755c4; outline-offset: -3px; }
#mipai-modal .mipai-result-numbers { gap: clamp(6px, 1.6vw, 14px); }

/* Local replacements for the former runtime utility stylesheet. */
.flex { display: flex; }.items-center { align-items: center; }
button, select { font-family: inherit; line-height: inherit; }
button { border-style: solid; }
.show9_mipai { border: 0; }
svg { vertical-align: middle; }
