﻿:root {
    --bg: #f7f8fb;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #475569;
    --border: rgba(15, 23, 42, 0.14);
    --shadow: 0 14px 34px rgba(15, 23, 42, 0.10);

    --accent: #4f46e5;
    --accentSoft: rgba(79, 70, 229, 0.10);
}

* { box-sizing: border-box; }

.hidden { display: none !important; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(1000px 700px at 20% 0%, rgba(79, 70, 229, 0.10) 0%, transparent 55%),
        radial-gradient(900px 650px at 90% 20%, rgba(14, 165, 233, 0.08) 0%, transparent 55%),
        var(--bg);
}

.app {
    max-width: 980px;
    margin: 0 auto;
    padding: 18px 16px 28px;
}

.header {
    margin: 6px 0 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.titleBox,
.howtoBox {
    display: inline-block;
    background: #fff;
    padding: 12px 14px;
    border-radius: 6px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.title {
    margin: 0 0 10px;
    font-size: 22px;
    letter-spacing: 0.6px;
    text-align: center;
}

.titleBox .title {
    margin-bottom: 0;
}

.howto {
    width: 100%;
}

.howtoBox {
    padding: 8px 12px;
    position: relative;
}

.howtoSizer {
    position: absolute;
    inset: 0 auto auto 0;
    visibility: hidden;
    white-space: nowrap;
    pointer-events: none;
}

.howtoSummary {
    list-style: none;
    appearance: none;
    border: none;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    user-select: none;
    width: 100%;
}

.howtoSummary::-webkit-details-marker { display: none; }

.howtoSummary::before {
    content: "▶";
    font-size: 12px;
    transform: translateY(-0.5px);
}

.howto[open] > .howtoSummary::before {
    content: "▼";
}

.howtoSummary:hover {
    background: rgba(15, 23, 42, 0.04);
}

.howtoPanel {
    margin: 10px auto 0;
    width: 100%;
    text-align: left;
    color: var(--text);
    background: #fff;
    border-radius: 6px;
    padding: 10px 12px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    line-height: 1.55;
}

.howtoPanel > div + div { margin-top: 4px; }

.status {
    min-height: 1.1em;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.25;
}

.status.inRing {
    margin-top: 10px;
    text-align: center;
}

.main {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.btn {
    appearance: none;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    padding: 10px 12px;
    border-radius: 8px;
    font-weight: 650;
    letter-spacing: 0.2px;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
    transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover { background: #f8fafc; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn.primary {
    border-color: rgba(79, 70, 229, 0.35);
    background: var(--accentSoft);
}

.timerCard {
    width: min(92vw, 420px);
    padding: 16px;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.timerWrap {
    position: relative;
    width: min(86vw, 360px);
    height: min(86vw, 360px);
    margin: 0 auto;
}

.ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ringBg {
    fill: none;
    stroke: rgba(15, 23, 42, 0.10);
    stroke-width: 10;
}

.ringFg {
    fill: none;
    stroke: var(--accent);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    filter: drop-shadow(0 10px 16px rgba(79, 70, 229, 0.20));
    transition: stroke-dashoffset 0.08s linear;
}

.timerInner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 22px;
    gap: 12px;
    text-align: center;
}

.startArea {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.startInRing {
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 16px;
    min-width: 120px;
}

.innerPanel {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.meta {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 14px;
}

.metaItem {
    display: flex;
    gap: 8px;
    align-items: baseline;
}

.metaLabel {
    font-size: 12px;
    color: var(--muted);
}

.metaValue {
    font-size: 14px;
    font-weight: 750;
}

.cpuLabel {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}

.cpuWord {
    font-size: clamp(18px, 4.4vw, 30px);
    font-weight: 850;
    letter-spacing: 0.4px;
    word-break: break-word;
}

.cpuMain {
    font-size: 1em;
}

.cpuSub {
    margin-top: 6px;
    font-size: 0.62em;
    font-weight: 750;
    color: var(--muted);
    letter-spacing: 0.1px;
}

.inputRow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.text {
    width: min(64vw, 220px);
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    outline: none;
}

.text::placeholder { color: rgba(15, 23, 42, 0.40); }
.text:disabled { opacity: 0.70; }

.scores {
    display: flex;
    justify-content: center;
    gap: 14px;
    color: var(--muted);
    font-size: 13px;
}

.actions {
    display: flex;
    justify-content: center;
    width: 100%;
}

.chatCard {
    width: min(92vw, 740px);
    padding: 14px;
    border: none;
    background: var(--card);
    border-radius: 6px;
    box-shadow: var(--shadow);
}

.sectionTitle {
    font-size: 13px;
    color: var(--muted);
    letter-spacing: 0.3px;
    margin: 0 0 10px;
}

.chat {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: min(52vh, 520px);
    overflow: auto;
    padding-right: 6px;
}

.chatTurn {
    border: none;
    background: #fff;
    border-radius: 8px;
    padding: 10px;
}

.chatMeta {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 8px;
}

.chatMsg {
    display: flex;
    gap: 10px;
    align-items: baseline;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.35;
    padding: 8px 10px;
    border-radius: 6px;
    border: none;
    background: rgba(79, 70, 229, 0.04);
}

.chatMsg + .chatMsg { margin-top: 8px; }

.chatMsg.user {
    justify-content: flex-start;
}

.chatMsg.cpu {
    justify-content: flex-end;
    text-align: right;
    background: rgba(14, 165, 233, 0.04);
}

.chatNote {
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
}

.debug {
    width: min(92vw, 740px);
    color: var(--muted);
}

.debug pre {
    white-space: pre-wrap;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.35;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: rgba(15, 23, 42, 0.92);
    margin: 10px 0 0;
}
