:root {
    --primary: #1f2937;
    --primary-600: #111827;
    --text: #111827;
    --muted: #6b7280;
    --bg: #f3f2ee;
    --card: #ffffff;
    --surface: #f9f8f5;
    --border: #e4e0d8;
    --border-strong: #d8d3ca;
    --row: #fbfaf7;
    --shadow: 0 10px 26px rgba(17, 24, 39, 0.08);
    --shadow-soft: 0 2px 8px rgba(17, 24, 39, 0.06);
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
}

.container {
    max-width: 1100px;
    margin: 30px auto 46px;
    padding: 28px 30px 32px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    animation: page-enter 0.28s ease-out both;
}

form {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

h1,
h2,
h3 {
    font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

h2 {
    text-align: center;
    margin: 0 0 20px;
    letter-spacing: 0.02em;
    font-size: 34px;
    font-weight: 700;
}

h3 {
    margin: 0 0 12px;
    color: #2a2f36;
    font-weight: 650;
    font-size: 20px;
}

.user-info {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px 18px 12px;
    margin-bottom: 16px;
}

.user-info label {
    display: block;
    margin-bottom: 12px;
    font-size: 15px;
}

.user-info input,
.user-info select {
    width: 100%;
    max-width: 560px;
    padding: 10px 12px;
    margin-top: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.user-info input:focus,
.user-info select:focus {
    outline: none;
    border-color: #c7d0db;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.18);
    background: #fff;
}

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

.line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.line input {
    width: 420px;
    max-width: 100%;
    flex: 0 1 420px;
    display: inline-block;
    vertical-align: middle;
}

.line .hint {
    display: inline-block;
    width: auto;
    text-align: left;
    vertical-align: middle;
    margin-left: 0;
    white-space: nowrap;
}

.section-title {
    font-weight: 650;
    margin: 14px 0 8px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-strong);
}

.shipping-choice {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin: 0 0 4px !important;
    line-height: 1.35;
}

.shipping-choice input[type="radio"] {
    width: auto;
    margin: 0;
}

#addrHint {
    margin-bottom: 8px;
}

.expand-collapse {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 16px 0 14px;
}

button,
.button {
    display: inline-block;
    padding: 10px 18px;
    background: var(--primary);
    color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: transform 0.08s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button:hover,
.button:hover {
    background: var(--primary-600);
}

button:active,
.button:active {
    transform: translateY(1px);
}

.category {
    border: 1px solid var(--border);
    margin-bottom: 12px;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.category:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-soft);
}

.category-header {
    background: #f3f2ee;
    color: var(--text);
    padding: 12px 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    font-weight: 650;
    letter-spacing: 0.01em;
}

.category-header .toggle-icon {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    font-weight: 700;
}

.category-items {
    display: none;
    padding: 8px 14px 12px;
    background: #fff;
}

.product-row {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) 130px 170px 120px;
    gap: 12px;
    align-items: center;
    padding: 11px 2px;
    border-bottom: 1px solid #f0ede7;
}

.product-row:last-child {
    border-bottom: none;
}

.product-name {
    min-width: 0;
    line-height: 1.45;
    color: #1f2937;
}

.product-price {
    text-align: right;
    color: #374151;
    font-variant-numeric: tabular-nums;
}

.quantity-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.quantity-wrapper input[type=number] {
    -moz-appearance: textfield;
    -webkit-appearance: none;
    margin: 0;
    width: 56px;
    height: 32px;
    text-align: center;
    line-height: 30px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.quantity-wrapper input::-webkit-inner-spin-button,
.quantity-wrapper input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-wrapper button {
    width: 32px;
    height: 32px;
    font-size: 16px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    cursor: pointer;
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    box-shadow: none;
    padding: 0;
}

.quantity-wrapper button:hover {
    background: #f3f2ee;
}

.item-subtotal {
    text-align: right;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.category-subtotal {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-strong);
    text-align: right;
    font-weight: 650;
    color: #374151;
}

.total-box {
    position: sticky;
    bottom: 12px;
    z-index: 3;
    margin-top: 16px;
    margin-bottom: 8px;
    padding: 12px 16px 10px;
    background: #ffffff;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(17, 24, 39, 0.1);
}

.total-amount {
    margin: 0;
    padding: 0;
    text-align: right;
    font-weight: 700;
    font-size: 22px;
    line-height: 1.35;
}

.shipping-summary {
    text-align: right;
    margin: 4px 2px 0;
    color: #374151;
    font-size: 14px;
    line-height: 1.45;
}

.total-note {
    text-align: right;
    margin: -2px 2px 12px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.captcha-submit-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin: 4px 0 14px;
}

.captcha-submit-row input {
    width: 120px;
    max-width: 120px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}

.captcha-submit-row input:focus {
    outline: none;
    border-color: #c7d0db;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.18);
}

.captcha-label {
    font-weight: 600;
}

form > .button[type="submit"] {
    display: block;
    margin-left: auto;
    min-width: 220px;
}

@keyframes page-enter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 980px) {
    .container {
        margin: 20px 14px 30px;
        padding: 20px 16px 24px;
    }

    h2 {
        font-size: 30px;
    }

    .product-row {
        grid-template-columns: minmax(0, 1.8fr) 110px 160px 110px;
    }
}

@media (max-width: 760px) {
    h2 {
        font-size: 26px;
    }

    .user-info {
        padding: 14px 12px 8px;
    }

    .user-info input,
    .user-info select {
        max-width: 100%;
    }

    .line input {
        width: 100%;
        max-width: 100%;
        display: block;
    }

    .line .hint {
        display: block;
        width: auto;
        text-align: left;
        margin: 4px 0 0;
        white-space: normal;
    }

    .expand-collapse {
        justify-content: stretch;
    }

    .expand-collapse .button {
        flex: 1;
        text-align: center;
        margin: 0;
    }

    .category-items {
        padding: 8px 10px 10px;
    }

    .product-row {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 10px 0;
    }

    .product-price,
    .item-subtotal {
        text-align: left;
    }

    .quantity-wrapper {
        justify-content: flex-start;
    }

    .total-box {
        position: static;
        padding: 10px 12px;
        margin-bottom: 6px;
    }

    .total-amount {
        font-size: 19px;
        text-align: left;
    }

    .total-note {
        text-align: left;
        margin: 2px 0 10px;
    }

    .shipping-summary {
        text-align: left;
        margin: 2px 0 0;
    }

    .captcha-submit-row {
        align-items: flex-start;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    form > .button[type="submit"] {
        width: 100%;
        margin-left: 0;
    }
}
