:root {
    --bg: #e7f1eb;
    --card: #ffffff;
    --line: #d8e6dd;
    --text: #10231d;
    --text-2: #25483d;
    --muted: #63756d;
    --green: #006f4c;
    --green-dark: #08372e;
    --navy: #10213f;
    --gold: #d8a43a;
    --red: #c92b35;
    --shadow: 0 12px 32px rgba(16, 35, 29, .12);
    --radius: 4px;
    --sans: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    padding-top: 62px;
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
    font-family: var(--sans);
    color: var(--text);
    background: var(--bg);
    background-image:
        linear-gradient(180deg, rgba(10, 57, 47, .13) 0, rgba(10, 57, 47, 0) 260px),
        repeating-linear-gradient(90deg, rgba(0, 111, 76, .05) 0 72px, rgba(255, 255, 255, .44) 72px 144px);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
select {
    font-family: inherit;
}

.site-app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 120;
    width: 100%;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid rgba(216, 230, 221, .92);
    box-shadow: 0 8px 24px rgba(16, 35, 29, .08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.site-app-header-inner {
    max-width: 730px;
    min-height: 62px;
    margin: 0 auto;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-app-logo {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-app-logo-box {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid rgba(216, 164, 58, .36);
    background: linear-gradient(135deg, var(--green), var(--navy));
}

.site-app-logo-box img {
    width: 100%;
    height: 100%;
    display: block;
}

.site-app-logo-text {
    min-width: 0;
    display: block;
}

.site-app-logo-text strong,
.site-app-logo-text small {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.site-app-logo-text strong {
    color: var(--navy);
    font-size: 16px;
    line-height: 1.1;
    font-weight: 900;
}

.site-app-logo-text small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.site-app-action-link {
    flex: 0 0 auto;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 11px;
    border-radius: var(--radius);
    border: 1px solid rgba(216, 164, 58, .42);
    background: linear-gradient(180deg, #fff9e8 0%, #e8f6ee 100%);
    color: var(--green-dark);
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.wrap {
    max-width: 730px;
    margin: 0 auto;
    padding: 12px 12px 28px;
}

.hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid rgba(216, 164, 58, .45);
    background: linear-gradient(135deg, #08372e 0%, #0a6e4c 48%, #12233f 100%);
    box-shadow: var(--shadow);
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, transparent 0 48%, rgba(255, 255, 255, .2) 48% 48.5%, transparent 48.5% 100%),
        repeating-linear-gradient(90deg, rgba(255,255,255,.045) 0 38px, rgba(255,255,255,.09) 38px 76px),
        linear-gradient(135deg, rgba(201,43,53,.2) 0 22%, transparent 22% 70%, rgba(216,164,58,.22) 70% 100%);
}

.hero::after {
    content: "WORLD CUP 2026";
    position: absolute;
    top: 12px;
    right: 14px;
    padding: 4px 8px;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: var(--radius);
    background: rgba(16, 33, 63, .28);
    color: rgba(255,255,255,.92);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .08em;
}

.hero-inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 94px;
    gap: 18px;
    align-items: center;
    min-height: 174px;
    padding: 38px 18px 18px;
}

.worldcup-kicker {
    color: #f4d37c;
    font-size: 11px;
    font-weight: 900;
}

.hero h1 {
    margin: 6px 0 8px;
    color: #fff;
    font-size: 28px;
    line-height: 1.15;
}

.hero p {
    margin: 0;
    max-width: 660px;
    color: rgba(255,255,255,.88);
    font-size: 13px;
    line-height: 1.65;
}

.trophy-mark {
    width: 84px;
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trophy-mark svg {
    width: 78px;
    height: 78px;
}

.cup-fill {
    fill: rgba(244, 211, 124, .24);
}

.cup-line {
    fill: none;
    stroke: rgba(255,255,255,.92);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.control-panel,
.champion-card,
.bracket-panel,
.notes-panel {
    margin-top: 12px;
    border: 1px solid rgba(216, 164, 58, .18);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: 0 8px 20px rgba(16, 35, 29, .07);
}

.control-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
    padding: 12px;
}

.control-group {
    min-width: 0;
}

.control-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
}

.control-group select,
.primary-btn {
    min-height: 40px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 800;
}

.control-group select {
    width: 100%;
    padding: 0 10px;
    border: 1px solid #bfd4c8;
    background: #fff;
    color: var(--text);
}

.primary-btn {
    cursor: pointer;
}

.primary-btn {
    min-width: 104px;
    border: 1px solid rgba(216, 164, 58, .28);
    background: linear-gradient(135deg, var(--green), #0f6a4b 56%, #8a631b 100%);
    color: #fff;
    box-shadow: 0 10px 22px rgba(0, 111, 76, .18);
}

.primary-btn:disabled {
    cursor: wait;
    opacity: .68;
}

.champion-label {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.champion-card {
    position: relative;
    overflow: hidden;
    padding: 16px;
    background:
        linear-gradient(120deg, rgba(216,164,58,.16), transparent 45%),
        #fff;
}

.champion-card:not(.is-empty)::after {
    content: "CHAMPION";
    position: absolute;
    right: 14px;
    top: 14px;
    color: rgba(216, 164, 58, .2);
    font-size: 34px;
    font-weight: 900;
}

.champion-main {
    position: relative;
    z-index: 1;
    margin-top: 4px;
    color: var(--navy);
    font-size: 26px;
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 10px;
}

.champion-main img {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 999px;
    border: 1px solid rgba(216,230,221,.9);
    background: #fff;
}

.champion-sub {
    position: relative;
    z-index: 1;
    margin-top: 6px;
    color: var(--text-2);
    font-size: 13px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #fff 0, #f5fbf7 72%, #fff9e8 100%);
}

.panel-head h2,
.notes-panel h2 {
    margin: 0;
    color: var(--navy);
    font-size: 16px;
}

.panel-head p,
.notes-panel p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.rounds {
    display: grid;
    grid-template-columns: repeat(5, minmax(190px, 1fr));
    gap: 10px;
    padding: 12px;
    overflow-x: auto;
    cursor: grab;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 111, 76, .34) rgba(216, 230, 221, .52);
}

.rounds.is-dragging {
    cursor: grabbing;
    scroll-behavior: auto;
    user-select: none;
}

.rounds.is-dragging * {
    pointer-events: none;
}

.round {
    min-width: 190px;
}

.round-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 28px;
    color: var(--navy);
    font-size: 13px;
    font-weight: 900;
}

.round-title span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.match-card {
    margin-top: 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #fff 0, #f8fbf9 100%);
}

.team-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 7px;
    align-items: center;
    min-height: 30px;
    padding: 4px 5px;
    border-radius: var(--radius);
}

.team-row.is-winner {
    background: #fff7df;
    color: #6d4b12;
    font-weight: 900;
}

.team-row + .team-row {
    margin-top: 3px;
}

.flag {
    width: 24px;
    height: 24px;
    overflow: hidden;
    border-radius: 999px;
    border: 1px solid rgba(216,230,221,.9);
    background: #fff;
}

.flag img {
    width: 100%;
    height: 100%;
    display: block;
}

.team-name {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px;
}

.team-score {
    font-family: var(--mono);
    color: var(--muted);
    font-size: 11px;
}

.match-meta {
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.notes-panel {
    padding: 14px;
}

.page-loading {
    position: fixed;
    inset: 0;
    z-index: 130;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(233, 241, 236, .78);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.loading-card {
    min-width: 180px;
    padding: 18px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: var(--shadow);
    text-align: center;
}

.loading-spinner {
    width: 34px;
    height: 34px;
    margin: 0 auto 10px;
    border-radius: 50%;
    border: 3px solid rgba(0,111,76,.16);
    border-top-color: var(--green);
    animation: spin 1s linear infinite;
}

.loading-text {
    font-size: 12.5px;
    color: var(--text-2);
}

.simulation-overlay {
    position: fixed;
    inset: 0;
    z-index: 160;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background:
        radial-gradient(circle at 50% 28%, rgba(216, 164, 58, .22), transparent 32%),
        rgba(7, 32, 28, .76);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.simulation-overlay.is-active {
    display: flex;
}

.simulation-card {
    position: relative;
    width: min(420px, 100%);
    overflow: hidden;
    padding: 22px 18px 18px;
    border-radius: var(--radius);
    border: 1px solid rgba(244, 211, 124, .45);
    background:
        linear-gradient(90deg, transparent 0 48%, rgba(255, 255, 255, .13) 48% 48.6%, transparent 48.6% 100%),
        repeating-linear-gradient(90deg, rgba(255,255,255,.045) 0 34px, rgba(255,255,255,.08) 34px 68px),
        linear-gradient(135deg, #08372e 0%, #0a6e4c 52%, #12233f 100%);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .34);
    color: #fff;
    text-align: center;
}

.simulation-card::after {
    content: "";
    position: absolute;
    left: -45%;
    top: 0;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.22), transparent);
    transform: skewX(-18deg);
    animation: scanLight 1.8s ease-in-out infinite;
}

.simulation-cup,
.simulation-kicker,
.simulation-title,
.simulation-text,
.simulation-progress,
.simulation-steps {
    position: relative;
    z-index: 1;
}

.simulation-cup {
    width: 70px;
    height: 70px;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f4d37c;
    animation: cupPulse 1.2s ease-in-out infinite;
}

.simulation-cup svg {
    width: 68px;
    height: 68px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.simulation-kicker {
    color: #f4d37c;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
}

.simulation-title {
    margin-top: 7px;
    font-size: 19px;
    font-weight: 900;
}

.simulation-text {
    min-height: 38px;
    margin-top: 8px;
    color: rgba(255,255,255,.84);
    font-size: 13px;
    line-height: 1.55;
}

.simulation-progress {
    height: 8px;
    margin-top: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255,255,255,.18);
}

.simulation-progress span {
    display: block;
    width: 12%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #f4d37c, #ffffff);
    box-shadow: 0 0 16px rgba(244, 211, 124, .54);
    transition: width .38s ease;
}

.simulation-steps {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    margin-top: 12px;
}

.simulation-steps span {
    min-width: 0;
    padding: 5px 3px;
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,.18);
    color: rgba(255,255,255,.62);
    font-size: 11px;
    font-weight: 800;
}

.simulation-steps span.is-active {
    border-color: rgba(244, 211, 124, .58);
    background: rgba(244, 211, 124, .16);
    color: #f4d37c;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes cupPulse {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-2px) scale(1.04);
    }
}

@keyframes scanLight {
    0% {
        left: -45%;
    }
    100% {
        left: 110%;
    }
}

.site-footer {
    margin-top: 22px;
    padding: 18px 12px calc(22px + env(safe-area-inset-bottom));
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}

.law-note {
    margin-bottom: 10px;
    color: #ef4444;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 8px;
}

.footer-links a {
    color: var(--text-2);
}

.footer-links .sep {
    opacity: .35;
}

.footer-meta {
    margin-top: 10px;
    line-height: 1.6;
}

.footer-meta .slogan {
    margin-top: 4px;
    font-size: 11px;
    opacity: .8;
}

.app-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    width: 100%;
    background: rgba(255, 255, 255, .96);
    border-top: 1px solid rgba(216, 230, 221, .95);
    box-shadow: 0 -12px 30px rgba(16, 35, 29, .10);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.app-tabbar-inner {
    max-width: 760px;
    margin: 0 auto;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px));
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
}

.app-tab {
    min-width: 0;
    min-height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: var(--radius);
    color: #5f746b;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    transition: background .16s ease, color .16s ease;
}

.app-tab svg {
    width: 23px;
    height: 23px;
    display: block;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.app-tab span {
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.app-tab:hover,
.app-tab.active {
    color: var(--green-dark);
    background: #e1f5ec;
}

@media (max-width: 768px) {
    body {
        padding-top: 56px;
    }

    .site-app-header-inner {
        min-height: 56px;
    }

    .site-app-logo-box {
        width: 32px;
        height: 32px;
    }

    .site-app-logo-text strong {
        font-size: 14px;
    }

    .site-app-action-link {
        min-height: 32px;
        padding: 0 8px;
        font-size: 12px;
    }

    .hero-inner {
        grid-template-columns: minmax(0, 1fr);
        min-height: auto;
        padding: 38px 14px 14px;
    }

    .trophy-mark {
        display: none;
    }

    .hero h1 {
        font-size: 23px;
    }

    .control-panel {
        grid-template-columns: 1fr 1fr;
    }

    .primary-btn {
        width: 100%;
    }

    .rounds {
        grid-template-columns: repeat(5, 210px);
    }
}

@media (max-width: 520px) {
    .site-app-logo-text small {
        display: none;
    }

    .control-panel {
        grid-template-columns: 1fr;
    }

    .panel-head {
        align-items: stretch;
        flex-direction: column;
    }

}
