:root {
    color-scheme: light;
    --blue: #405fa7;
    --cyan: #43bdd8;
    --green: #36a979;
    --yellow: #d9b51d;
    --red: #ee3141;
    --teal: #46b8b8;
    --ink: #333;
    --muted: #7e838c;
    --line: #dedede;
    --paper: #fff;
    --wash: #eaeaea;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--wash);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

body {
    margin: 0;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    font: inherit;
}

.topbar,
.layout,
.footer {
    width: min(980px, 100%);
    margin-inline: auto;
    background: var(--paper);
}

.topbar {
    margin-top: 8px;
    border: 1px solid #d7d7d7;
    box-shadow: 0 0 5px rgb(0 0 0 / 18%);
}

.brand {
    min-height: 112px;
    padding: 20px 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    color: #fff;
    background:
        linear-gradient(120deg, rgb(15 22 31 / 96%), rgb(45 50 57 / 90%)),
        repeating-linear-gradient(135deg, transparent 0 26px, rgb(255 255 255 / 7%) 26px 28px);
    text-align: left;
}

.brand__mark {
    width: 66px;
    height: 66px;
    display: grid;
    place-items: center;
    border: 2px solid #efcf70;
    border-radius: 50%;
    color: #efcf70;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
}

.brand__name {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: .05em;
}

.brand__note {
    margin-top: 7px;
    color: rgb(255 255 255 / 68%);
    font-size: 13px;
}

.entry-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--line);
}

.entry-nav a {
    min-width: 0;
    height: 40px;
    display: grid;
    place-items: center;
    position: relative;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    color: #333;
    background: #fff;
    text-decoration: none;
    font-size: 18px;
}

.entry-nav a:nth-child(3n) {
    border-right: 0;
}

.entry-nav a:nth-last-child(-n + 3) {
    border-bottom: 0;
}

.entry-nav a:hover {
    background: #fafafa;
}

.entry-nav a[aria-current="page"] {
    color: #397ae3;
    background: #f7f7f7;
}

.entry-nav a[aria-current="page"]::after {
    content: "";
    height: 2px;
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    background: #fe474b;
}

.layout {
    padding: 14px 8px 0;
    box-shadow: 0 2px 5px rgb(0 0 0 / 12%);
}

.notice {
    display: none;
    margin: 0 0 10px;
    padding: 10px 13px;
    border: 1px solid #eab8b6;
    color: #92312b;
    background: #fff2f1;
    font-size: 13px;
}

.notice.is-visible {
    display: block;
}

.hero {
    padding: 8px;
    border: 1px solid var(--line);
    background: #f6f5f5;
}

.hero__main,
.hero__clock {
    border: 1px solid var(--line);
    background: #fff;
}

.hero__main {
    text-align: center;
}

.hero__identity {
    min-height: 66px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}

.hero__emblem {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid #e6e6e6;
    border-radius: 50%;
    color: var(--red);
    font-size: 21px;
}

.hero h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.issue-line {
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
}

.balls {
    min-height: 72px;
    padding: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ball {
    min-width: 39px;
    height: 39px;
    padding: 0 7px;
    display: inline-grid;
    place-items: center;
    border-radius: 2px;
    color: #fff;
    background: var(--teal);
    font-size: 21px;
    font-weight: 500;
}

.ball--sum {
    background: #37a779;
}

.operator {
    color: #444;
    font-size: 16px;
}

.result-tags {
    min-height: 0;
    display: flex;
    justify-content: center;
    gap: 5px;
}

.result-tags:not(:empty) {
    padding: 0 12px 12px;
}

.result-tag {
    min-width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
}

.result-tag--size {
    background: #3599db;
}

.result-tag--parity {
    background: #e51b2b;
}

.hero__clock {
    min-height: 72px;
    margin-top: 5px;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

.clock__label,
.clock__time {
    color: #4f535a;
    font-size: 13px;
}

.clock__value {
    min-width: 112px;
    padding: 4px 9px;
    color: #fff;
    background: #e83c4b;
    font: 400 28px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
    letter-spacing: .03em;
}

.tabs {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    overflow: hidden;
}

.tab {
    min-width: 0;
    padding: 10px 6px;
    border: 0;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
}

.tab--history {
    background: var(--blue);
}

.tab--prediction {
    background: var(--green);
}

.tab--trend {
    background: var(--cyan);
}

.tab--stats {
    background: var(--yellow);
}

.tab:hover,
.tab:focus-visible,
.tab[aria-selected="true"] {
    filter: brightness(.88);
    outline: none;
}

.tab[aria-selected="true"] {
    box-shadow: inset 0 -3px 0 rgb(255 255 255 / 78%);
}

.tab__icon {
    margin-right: 5px;
    font-size: 16px;
}

.panel {
    display: none;
    min-height: 320px;
    padding: 12px 8px 20px;
    border: 1px solid var(--line);
    border-top: 0;
    background: #fff;
}

.panel.is-active {
    display: block;
}

.panel h3 {
    margin: 0 0 10px;
    color: #5e626a;
    font-size: 14px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 14px;
}

th,
td {
    padding: 7px 6px;
    overflow: hidden;
    border: 1px solid #e4e7ed;
    color: #606266;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

th {
    color: #303133;
    background: #f5f6f8;
    font-weight: 700;
}

th:first-child,
td:first-child {
    width: 25%;
}

th:nth-child(2),
td:nth-child(2) {
    width: 31%;
}

th:nth-child(3),
td:nth-child(3) {
    width: 44%;
}

.equation {
    color: #3f454e;
}

.mini-balls {
    display: inline-flex;
    justify-content: center;
    gap: 4px;
}

.mini-ball {
    min-width: 23px;
    height: 23px;
    padding: 0 4px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #e84c47;
    font-size: 10px;
    font-weight: 700;
}

.prediction {
    padding: 22px;
    border: 1px solid #e4e7ed;
    background: #fafafa;
    text-align: center;
}

.prediction__issue {
    color: var(--muted);
    font-size: 13px;
}

.empty {
    min-height: 150px;
    display: grid;
    place-items: center;
    color: var(--muted);
    text-align: center;
    font-size: 14px;
}

.trend-grid {
    display: grid;
    gap: 6px;
}

.trend-row {
    display: grid;
    grid-template-columns: minmax(75px, 110px) 1fr;
    align-items: center;
    gap: 10px;
    color: #606266;
    font-size: 12px;
}

.trend-row__bars {
    min-height: 23px;
    display: flex;
    gap: 2px;
}

.trend-cell {
    min-width: 14px;
    flex: 1 1 0;
    border-radius: 2px;
    background: #e7e9ed;
}

.trend-cell--low {
    background: #67a7d7;
}

.trend-cell--high {
    background: #ef725f;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.stat-card {
    padding: 15px;
    border: 1px solid #e4e7ed;
    background: #fafafa;
}

.stat-card__label,
.stat-card__note {
    color: var(--muted);
    font-size: 12px;
}

.stat-card__value {
    margin-top: 6px;
    color: #405fa7;
    font-size: 22px;
    font-weight: 700;
}

.stat-card__note {
    margin-top: 5px;
}

.footer {
    padding: 16px 12px 22px;
    box-shadow: 0 3px 5px rgb(0 0 0 / 12%);
    color: #8d929b;
    font-size: 12px;
    text-align: center;
}

.footer__status {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.footer__note {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ececec;
}

.status--ok {
    color: #16845b;
}

.status--bad {
    color: #bd2d28;
}

[hidden] {
    display: none !important;
}

@media (max-width: 720px) {
    .topbar {
        margin-top: 0;
        border-right: 0;
        border-left: 0;
        box-shadow: none;
    }

    .brand {
        min-height: 76px;
        padding: 12px 16px;
        justify-content: flex-start;
    }

    .brand__mark {
        width: 48px;
        height: 48px;
        font-size: 9px;
    }

    .brand__name {
        font-size: 20px;
    }

    .brand__note {
        margin-top: 3px;
        font-size: 11px;
    }

    .entry-nav a {
        height: 36px;
        font-size: 15px;
    }

    .layout {
        padding: 8px 7px 0;
        box-shadow: none;
    }

    .hero {
        padding: 6px;
    }

    .hero__identity {
        min-height: 60px;
    }

    .hero__emblem {
        width: 38px;
        height: 38px;
    }

    .balls {
        min-height: 62px;
        padding: 10px 7px;
        gap: 5px;
    }

    .ball {
        min-width: 34px;
        height: 34px;
        padding: 0 5px;
        font-size: 18px;
    }

    .operator {
        font-size: 14px;
    }

    .result-tag {
        min-width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .hero__clock {
        min-height: 61px;
        padding: 7px;
        gap: 7px;
    }

    .clock__value {
        min-width: 102px;
        padding-inline: 6px;
        font-size: 24px;
    }

    .clock__time {
        display: none;
    }

    .tabs {
        margin-top: 8px;
    }

    .tab {
        padding: 9px 3px;
        font-size: 12px;
    }

    .tab__icon {
        display: block;
        margin: 0 0 2px;
    }

    .panel {
        min-height: 260px;
        padding: 9px 5px 16px;
    }

    table {
        font-size: 12px;
    }

    th,
    td {
        padding: 6px 3px;
    }

    th:first-child,
    td:first-child {
        width: 26%;
    }

    th:nth-child(2),
    td:nth-child(2) {
        width: 33%;
    }

    th:nth-child(3),
    td:nth-child(3) {
        width: 41%;
    }

    .mini-balls {
        gap: 1px;
    }

    .mini-ball {
        min-width: 17px;
        height: 17px;
        padding: 0;
        font-size: 8px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer {
        padding-bottom: calc(18px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 370px) {
    .hero__emblem {
        display: none;
    }

    .ball {
        min-width: 31px;
        height: 31px;
        font-size: 16px;
    }

    .mini-ball {
        min-width: 16px;
        height: 16px;
        padding: 0;
        font-size: 7px;
    }
}
