/* ===================================================================
   /double-click-test

   .is-down on a mouse part follows the real mousedown/mouseup of that
   button; .is-double / .is-chatter flash the part when a double click or a
   chatter is recorded. The timeline is drawn by double-click-test.js.
   Scoped under .dc.
   =================================================================== */

.dc {
    --dc-accent: #3d8bff;
    --dc-accent-2: #22d3ee;
    --dc-bad: #f43f5e;
    --dc-ok: #22c55e;
    --dc-ink: #10162b;
    --dc-muted: #5b6275;
    --dc-line: #e4e7ef;
    --dc-b0: #3d8bff;
    --dc-b1: #a78bfa;
    --dc-b2: #f472b6;
    --dc-b3: #fbbf24;
    --dc-b4: #34d399;

    margin: 18px auto 24px;
    padding: 0;
    max-width: 1100px;
    border-radius: 28px;
    background: #fff;
    border: 1px solid var(--dc-line);
    box-shadow: 0 30px 60px -32px rgb(16 22 43 / 45%);
    overflow: hidden;
    text-align: left;
    color: var(--dc-ink);
    font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.dc *, .dc *::before, .dc *::after { box-sizing: border-box; }
.dc button { font: inherit; }
.dc svg { display: block; }
.dc :where(p) { margin: 0; }

.dc-visually-hidden {
    position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- top bar ---------- */

.dc-topbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
    padding: 12px 20px;
    background: linear-gradient(180deg, #151b33, #10162b);
    color: #cdd5ee;
}
.dc-setting { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dc-setting-label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #8f9bbd; }
.dc-seg { display: flex; gap: 3px; padding: 3px; border-radius: 999px; background: rgb(255 255 255 / 8%); }
.dc-seg button {
    min-height: 32px; padding: 0 11px; border: 0; border-radius: 999px; cursor: pointer;
    background: transparent; color: #aeb8d6; font-size: .8rem; font-weight: 700; white-space: nowrap;
    transition: background-color .15s ease, color .15s ease;
}
.dc-seg button:hover { color: #fff; }
.dc-seg button[aria-checked="true"] { background: #fff; color: var(--dc-ink); }
.dc-btn {
    display: inline-flex; align-items: center; gap: 8px; margin-left: auto;
    min-height: 36px; padding: 0 14px; border-radius: 12px; cursor: pointer;
    font-weight: 600; font-size: .88rem;
    transition: background-color .15s ease, transform .1s ease;
}
.dc-btn svg { width: 17px; height: 17px; }
.dc-btn:active { transform: translateY(1px); }
.dc-btn--ghost { background: rgb(255 255 255 / 8%); border: 1px solid rgb(255 255 255 / 14%); color: #dfe5f7; }
.dc-btn--ghost:hover { background: rgb(255 255 255 / 16%); color: #fff; }
.dc :where(button):focus-visible { outline: 3px solid var(--dc-accent-2); outline-offset: 2px; }

/* ---------- stage ---------- */

.dc-stage {
    display: grid; grid-template-columns: minmax(240px, 360px) minmax(0, 1fr); gap: clamp(18px, 3.5vw, 40px); align-items: stretch;
    padding: clamp(20px, 3.5vw, 40px);
    background:
        radial-gradient(45% 70% at 18% 60%, rgb(61 139 255 / 22%), transparent 70%),
        radial-gradient(40% 50% at 85% 0%, rgb(34 211 238 / 10%), transparent 70%),
        linear-gradient(180deg, #10162b 0%, #1a2142 100%);
    user-select: none; -webkit-user-select: none;
}

.dc-pad {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    padding: 18px 14px 14px; border-radius: 24px; cursor: pointer;
    background: rgb(255 255 255 / 4%); border: 1px dashed rgb(255 255 255 / 16%);
    touch-action: manipulation;
    transition: border-color .2s ease, background-color .2s ease;
}
.dc-pad:hover { border-color: rgb(106 169 255 / 55%); background: rgb(61 139 255 / 6%); }
.dc-mouse { width: 100%; max-width: 300px; height: auto; filter: drop-shadow(0 20px 22px rgb(0 0 0 / 45%)); }

.dc-part { transition: transform .07s ease; transform-box: view-box; }
.dc-face { fill: url(#dcShell); stroke: #0b0e1a; stroke-width: 2; transition: fill .15s ease; }
.dc-label { font: 700 15px/1 "Poppins", system-ui, sans-serif; letter-spacing: .1em; fill: #8f9bbd; text-anchor: middle; pointer-events: none; }
.dc-flash { fill: #fff; opacity: 0; transform-box: fill-box; transform-origin: center; pointer-events: none; }

.dc-part.is-down { transform: translateY(3px); }
.dc-part.is-down .dc-face { fill: var(--dc-accent); }
.dc-part--right.is-down .dc-face { fill: var(--dc-b2); }
.dc-part--middle.is-down .dc-face { fill: var(--dc-b1); }
.dc-part.is-down .dc-label { fill: #fff; }

.dc-part.is-double .dc-flash { animation: dc-burst .45s ease-out; }
.dc-part.is-chatter .dc-face { animation: dc-alarm .6s ease; }
.dc-part.is-chatter .dc-flash { fill: var(--dc-bad); animation: dc-burst .6s ease-out; }
@keyframes dc-burst { 0% { opacity: .75; transform: scale(.3); } 100% { opacity: 0; transform: scale(2.4); } }
@keyframes dc-alarm { 0%, 60% { fill: var(--dc-bad); } }

.dc-side-row { display: flex; gap: 8px; }
.dc-side {
    padding: 4px 12px; border-radius: 999px; font-size: .75rem; font-weight: 700;
    background: rgb(255 255 255 / 8%); color: #8f9bbd; transition: background-color .1s ease, color .1s ease;
}
.dc-side.is-down { background: var(--dc-b3); color: #1f1300; }
.dc-side[data-part="4"].is-down { background: var(--dc-b4); color: #002b1b; }
.dc-pad-hint { font-size: .85rem; font-weight: 600; color: #aeb8d6; }

.dc-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.dc-readout {
    display: flex; flex-direction: column; gap: 2px;
    padding: 16px 18px; border-radius: 20px; background: rgb(255 255 255 / 6%); border: 1px solid rgb(255 255 255 / 10%);
    color: #fff; transition: background-color .3s ease, border-color .3s ease;
}
.dc-readout-label { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8f9bbd; }
.dc-readout-value { font-size: 1.1rem; font-weight: 700; color: #aeb8d6; }
.dc-readout-value b { font-size: clamp(2.6rem, 6vw, 3.8rem); font-weight: 800; line-height: 1.05; color: #fff; font-variant-numeric: tabular-nums; }
.dc-readout-sub { font-size: .88rem; color: #aeb8d6; }
.dc-readout.is-pop { animation: dc-pop .3s ease; }
.dc-readout.is-chatter { background: rgb(244 63 94 / 18%); border-color: rgb(244 63 94 / 55%); }
.dc-readout.is-chatter .dc-readout-value b { color: #fda4af; }
@keyframes dc-pop { 40% { transform: scale(1.03); } }

.dc-timeline-card { flex: 1; padding: 12px 14px 10px; border-radius: 20px; background: rgb(255 255 255 / 5%); border: 1px solid rgb(255 255 255 / 10%); }
.dc-timeline-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: .75rem; color: #8f9bbd; }
.dc-legend { display: inline-flex; align-items: center; gap: 5px; }
.dc-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-left: 6px; }
.dc-dot--0 { background: var(--dc-b0); }
.dc-dot--1 { background: var(--dc-b1); }
.dc-dot--2 { background: var(--dc-b2); }
.dc-timeline { width: 100%; height: auto; margin-top: 8px; overflow: visible; }
.dc-timeline .dc-zone { fill: rgb(244 63 94 / 16%); }
.dc-timeline .dc-zone-edge { stroke: rgb(244 63 94 / 70%); stroke-dasharray: 4 3; }
.dc-timeline .dc-axis { stroke: rgb(255 255 255 / 25%); }
.dc-timeline .dc-tick { fill: #8f9bbd; font: 600 11px/1 "Poppins", system-ui, sans-serif; text-anchor: middle; }
.dc-timeline .dc-zone-label { fill: #fda4af; font: 700 10px/1 "Poppins", system-ui, sans-serif; letter-spacing: .06em; }
.dc-timeline .dc-point { stroke: #10162b; stroke-width: 2; }
.dc-timeline .dc-point.is-chatter { stroke: #fff; }
.dc-timeline .dc-point.is-new { animation: dc-point-in .35s cubic-bezier(.2, .8, .3, 1.4); transform-box: fill-box; transform-origin: center; }
.dc-timeline .dc-empty { fill: #8f9bbd; font: 500 13px/1 "Poppins", system-ui, sans-serif; text-anchor: middle; }
@keyframes dc-point-in { from { transform: scale(0); } }

/* ---------- panel ---------- */

.dc-panel { display: grid; gap: 14px; padding: 22px clamp(16px, 3vw, 32px) 4px; }

.dc-verdict {
    display: flex; flex-direction: column; gap: 2px;
    padding: 14px 16px; border-radius: 16px; border: 1px solid #dce6fb; background: #f4f7ff; color: #1d3a7a;
}
.dc-verdict strong { font-size: 1.05rem; }
.dc-verdict span { font-size: .92rem; }
.dc-verdict.is-ok { background: #ecfdf3; border-color: #bbf0cf; color: #14532d; }
.dc-verdict.is-warn { background: #fff7e6; border-color: #fde2a7; color: #7a4b00; }
.dc-verdict.is-bad { background: #fff1f3; border-color: #fecdd3; color: #9f1239; }

.dc-table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid var(--dc-line); }
.dc-table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.dc-table th { padding: 10px 12px; background: #f6f8fc; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--dc-muted); text-align: left; white-space: nowrap; }
.dc-table td { padding: 10px 12px; border-top: 1px solid var(--dc-line); white-space: nowrap; }
.dc-table td:first-child { font-weight: 700; }
.dc-table td:first-child i { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; vertical-align: 0; }
.dc-table tr.is-bad td { background: #fff1f3; }
.dc-table tr.is-bad td:nth-child(4) { color: #be123c; font-weight: 800; }
.dc-table tr.is-flash td { animation: dc-row .6s ease; }
@keyframes dc-row { 0% { background: #e8f0ff; } }

.dc-extra { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: .88rem; }
.dc-extra-note { font-size: .78rem; color: var(--dc-muted); }

.dc-note { margin: 14px clamp(16px, 3vw, 32px) 22px; font-size: .86rem; color: var(--dc-muted); }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
    .dc-stage { grid-template-columns: 1fr; }
    .dc-mouse { max-width: 260px; }
}
@media (max-width: 575.98px) {
    .dc { border-radius: 20px; }
    .dc-topbar { padding: 10px 12px; }
    .dc-setting { width: 100%; justify-content: space-between; }
    .dc-seg { flex: 1; }
    .dc-seg button { flex: 1; padding: 0 4px; }
    .dc-btn { margin-left: 0; }
    .dc-stage { padding: 16px; }
    .dc-mouse { max-width: 220px; }
}
@media (pointer: coarse) {
    .dc-seg button, .dc-btn { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
    .dc *, .dc *::before, .dc *::after { animation: none !important; transition: none !important; }
}
