:root {
    --bg: #f6f3ee;
    --panel: #fbf9f5;
    --panel-strong: #fffdf9;
    --text: #2c241d;
    --muted: #6f655c;
    --line: #ddd5ca;
    --accent: #d97757;
    --accent-hover: #c76646;
    --accent-dark: #3b312a;
    --soft: #f3eee7;
    --shadow: 0 16px 34px rgba(69, 50, 34, 0.07);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.7), transparent 30%),
        linear-gradient(180deg, #faf7f2 0%, var(--bg) 100%);
    color: var(--text);
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page {
    padding: 40px 16px;
}

.panel {
    width: min(100%, 720px);
    margin: 0 auto;
    padding: 30px 28px 24px;
    background: linear-gradient(180deg, var(--panel-strong) 0%, var(--panel) 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel-head h1 {
    margin: 0;
    font-size: 31px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.guide-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 18px;
    padding: 16px 18px;
    border: 1px solid rgba(171, 102, 0, 0.22);
    border-radius: 16px;
    background: linear-gradient(135deg, #fff1bf 0%, #ffd36f 100%);
    box-shadow: 0 14px 28px rgba(185, 118, 9, 0.16);
    color: #5c3200;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.guide-banner:hover {
    transform: translateY(-1px);
    filter: brightness(1.01);
    box-shadow: 0 18px 34px rgba(185, 118, 9, 0.2);
}

.guide-banner-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 88px;
    min-height: 42px;
    padding: 8px 16px;
    border-radius: 999px;
    background: #b45309;
    color: #fffdf7;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.guide-banner-text {
    flex: 1;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
}

.form {
    margin-top: 22px;
    display: flex;
    flex-direction: column;
}

.step-title {
    margin: 0 0 10px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.form input {
    width: 100%;
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--text);
    font: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form textarea {
    width: 100%;
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--text);
    font: inherit;
    outline: none;
    resize: vertical;
    min-height: 180px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form input:focus,
.form textarea:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(217, 119, 87, 0.12);
}

.field-error {
    margin-top: 8px;
    color: #dc2626;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

.hidden {
    display: none;
}

.field-invalid {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
}

.token-panel {
    margin-top: 18px;
    padding: 16px 16px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 253, 249, 0.72);
}

.code-panel {
    margin-top: 0;
    padding-bottom: 18px;
}

.code-title {
    margin-bottom: 12px;
}

.token-title {
    margin-bottom: 6px;
}

.token-desc,
.token-hint {
    margin: 0;
    color: var(--accent-dark);
    font-size: 13px;
    line-height: 1.55;
}

.token-hint {
    margin-top: 8px;
    color: var(--muted);
}

.token-input-title {
    margin: 14px 0 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 138px;
    min-height: 42px;
    padding: 9px 22px;
    border: none;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.submit-btn {
    align-self: flex-end;
}

.submit-btn:hover {
    background: var(--accent-hover);
}

.action-row {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 14px;
}

.query-panel {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.query-action-group {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
}

.query-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 110px;
    min-height: 42px;
    padding: 9px 22px;
    border: none;
    border-radius: 999px 0 0 999px;
    background: #ebe3d8;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.query-btn:hover {
    background: #e4dbcf;
}

.query-input {
    flex: 1;
    min-width: 0;
    height: 42px;
    padding: 0 15px;
    border: 1px solid var(--line);
    border-left: none;
    border-radius: 0 999px 999px 0 !important;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: none !important;
}

.query-input:focus {
    position: relative;
    z-index: 1;
}

.secondary-btn:disabled,
.query-btn:disabled,
.submit-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 144px;
    min-height: 42px;
    padding: 9px 18px;
    border: 1px solid #ccb8a5;
    border-radius: 999px;
    background: #fff8ef;
    color: var(--accent-dark);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.secondary-btn:hover {
    background: #fff2e4;
    border-color: #cfa07c;
}

.token-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 42px;
    margin-top: 14px;
    margin-bottom: 0;
    padding: 0 14px;
    border: 2px solid #c37d52;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    color: var(--accent);
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 0 0 rgba(217, 119, 87, 0.22);
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    animation: tokenPulse 1.35s ease-in-out infinite;
}

.token-link:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: #b5653d;
    color: #b5653d;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(217, 119, 87, 0.16);
    animation-play-state: paused;
}

.token-link::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.08) 38%, rgba(255, 255, 255, 0.8) 50%, rgba(255, 255, 255, 0.08) 62%, transparent 100%);
    transform: translateX(-140%);
    animation: tokenShine 1.55s ease-in-out infinite;
    pointer-events: none;
}

.token-link:hover::after {
    animation-duration: 1s;
}

@keyframes tokenPulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(217, 119, 87, 0.12);
        transform: scale(1);
        border-color: #c37d52;
        background: rgba(255, 255, 255, 0.72);
    }

    50% {
        box-shadow: 0 0 0 14px rgba(217, 119, 87, 0.16);
        transform: scale(1.018);
        border-color: #dc8457;
        background: rgba(255, 248, 243, 0.98);
    }
}

@keyframes tokenShine {
    0%,
    35%,
    100% {
        transform: translateX(-140%);
    }

    60% {
        transform: translateX(140%);
    }
}

.result-box {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.result-title {
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
}

.result-summary {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 10px;
    min-height: 32px;
}

.result-status-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.result-status-label {
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

.result-status-value {
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

.result-divider {
    width: 1px;
    height: 28px;
    background: var(--line);
}

.result-empty {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.result-content.hidden {
    display: none;
}

.result-list {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.result-list div {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--soft);
}

.result-list span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.result-list strong {
    display: block;
    line-height: 1.5;
}

.history-results {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    background: var(--soft);
}

.history-header,
.history-row {
    display: grid;
    grid-template-columns: 1.2fr 1.2fr 1.3fr 0.7fr;
    gap: 12px;
    padding: 12px 14px;
}

.history-header {
    background: rgba(255, 255, 255, 0.7);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.history-row {
    border-top: 1px solid var(--line);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

.history-empty {
    padding: 16px 14px;
    color: var(--muted);
    font-size: 14px;
}

.result-message {
    color: var(--muted);
    line-height: 1.6;
    font-size: 14px;
}

.result-info-title {
    margin-top: 12px;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.result-raw {
    margin: 8px 0 0;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--soft);
    overflow: auto;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.6;
}

.retry-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
    padding: 16px 18px;
    border: 1px solid #ead7c1;
    border-radius: 16px;
    background: linear-gradient(180deg, #fffaf4 0%, #fff4e7 100%);
}

.retry-copy {
    flex: 1;
    min-width: 0;
}

.retry-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
}

.retry-desc {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.retry-status-text {
    margin-top: 10px;
    color: var(--accent-dark);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.6;
}

.subscription-results {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.subscription-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    background: var(--panel-strong);
}

.subscription-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 16px;
    color: #fff;
}

.subscription-card-head.active {
    background: linear-gradient(135deg, #21856f 0%, #2fa07c 100%);
}

.subscription-card-head.expired {
    background: linear-gradient(135deg, #78716c 0%, #a8a29e 100%);
}

.subscription-card-head strong,
.subscription-card-head span {
    font-size: 14px;
    line-height: 1.3;
}

.subscription-card-body {
    display: grid;
    gap: 10px;
    padding: 14px 16px;
}

.subscription-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.subscription-field span {
    color: var(--muted);
    font-size: 13px;
}

.subscription-field strong {
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    text-align: right;
    word-break: break-word;
}

.subscription-field strong.good {
    color: #047857;
}

.subscription-field strong.bad {
    color: #b91c1c;
}

.subscription-empty {
    padding: 20px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--soft);
    color: var(--muted);
    text-align: center;
    font-size: 14px;
}

.stock-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-size: 31px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.stock-status-badge[data-status="in_stock"] {
    color: #047857;
}

.stock-status-badge[data-status="out_of_stock"] {
    color: #b91c1c;
}

.overwrite-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 10px;
    align-items: center;
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 253, 249, 0.72);
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
}

.overwrite-row small {
    grid-column: 2;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
}

.plus-recharge-query {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    max-width: none;
}

.token-query-input {
    grid-column: 1 / -1;
    min-height: 84px;
    resize: vertical;
}

@media (max-width: 640px) {
    .page {
        padding: 14px 12px;
    }

    .panel {
        padding: 20px 16px 18px;
    }

    .panel-head h1 {
        font-size: 24px;
    }

    .stock-status-badge {
        font-size: 24px;
        min-height: 32px;
    }

    .panel-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .guide-banner {
        flex-direction: column;
        align-items: stretch;
    }

    .guide-banner-label {
        width: 100%;
    }

    .guide-banner-text {
        font-size: 15px;
        text-align: center;
    }

    .submit-btn {
        width: 100%;
    }

    .action-row {
        flex-direction: column;
    }

    .query-action-group {
        width: 100%;
        max-width: none;
    }

    .subscription-field {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .subscription-field strong {
        text-align: left;
    }

    .query-btn {
        width: auto;
    }

    .form textarea {
        min-height: 132px;
    }

    .token-panel {
        padding: 14px 14px 12px;
    }

    .result-box {
        margin-top: 14px;
        padding-top: 12px;
    }

    .token-link {
        width: 100%;
        min-height: 44px;
        padding: 0 14px;
    }

    .result-summary {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .result-divider {
        width: 100%;
        height: 1px;
    }

    .result-list {
        grid-template-columns: 1fr;
    }

    .history-header {
        display: none;
    }

    .history-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

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

    .secondary-btn {
        width: 100%;
    }

    .plus-recharge-query {
        grid-template-columns: 1fr;
    }
}

.result-status-value.is-pending {
    color: #b56a1a;
}

.result-status-value.is-success {
    color: #2f6b3a;
}

.result-status-value.is-failed {
    color: var(--accent-dark);
}
