/* ============================================================
   1. Design Tokens & Reset
   ============================================================ */
:root {
    /* 明亮基底 */
    --color-bg: #f5f9ff;
    --color-surface: #ffffff;
    --color-surface-soft: #f8fbff;
    --color-text: #33415c;
    --color-heading: #1b2a41;
    --color-text-muted: #5b6b82;
    --color-border: #e3ebf6;
    --color-border-strong: #cfdcf0;

    /* 明亮主色：清新绿 + 阳光橙 + 天空蓝 */
    --color-primary: #22c55e;
    --color-primary-dark: #16a34a;
    --color-primary-darker: #15803d;
    --color-primary-soft: #dcfce7;
    --color-accent: #fb923c;
    --color-accent-hover: #f97316;
    --color-accent-soft: #ffedd5;
    --color-blue: #3b82f6;
    --color-blue-soft: #dbeafe;

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 14px;
    --radius-pill: 999px;

    --shadow-sm: 0 2px 8px rgba(27, 42, 65, 0.06);
    --shadow-md: 0 6px 18px rgba(27, 42, 65, 0.08);
    --shadow-lg: 0 12px 32px rgba(27, 42, 65, 0.12);
}

* {
    box-sizing: border-box;
}

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

body {
    font-family: 'Arial', 'Roboto', 'Helvetica', sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(180deg, #f0f7ff 0%, #f5f9ff 40%, #f8fbff 100%);
    background-attachment: fixed;
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   2. Header & Navigation
   ============================================================ */
.header {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 1px 0 rgba(27, 42, 65, 0.05), 0 4px 16px rgba(59, 130, 246, 0.06);
    top: 0;
    margin-bottom: 10px;
    position: sticky;
    z-index: 10;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    text-decoration: none;
    color: var(--color-heading);
    letter-spacing: -0.02em;
}

.logo:hover {
    color: var(--color-primary-dark);
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--color-text-muted);
    padding: 10px 14px;
    font-weight: 500;
    border-radius: var(--radius-pill);
    transition: color 0.25s ease, background-color 0.25s ease;
}

.nav-links a:hover {
    color: var(--color-primary-dark);
    background-color: var(--color-primary-soft);
}

/* Hamburger */
.hamburger {
    display: none;
    cursor: pointer;
    padding: 10px;
    width: 40px;
    height: 40px;
    position: relative;
    background: none;
    border: none;
    box-shadow: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.hamburger:hover,
.hamburger:active,
.hamburger:focus {
    background: none;
    border: none;
    outline: none;
    box-shadow: none;
}

.hamburger-lines,
.hamburger-lines::before,
.hamburger-lines::after {
    display: block;
    width: 20px;
    height: 2px;
    background-color: #5b6b82;
    position: absolute;
    left: 10px;
    border-radius: 2px;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.hamburger-lines {
    top: 50%;
    margin-top: -1px;
}

.hamburger-lines::before {
    content: '';
    top: -6px;
}

.hamburger-lines::after {
    content: '';
    bottom: -6px;
}

.hamburger.active .hamburger-lines {
    background-color: transparent;
}

.hamburger.active .hamburger-lines::before {
    transform: rotate(45deg);
    top: 0;
}

.hamburger.active .hamburger-lines::after {
    transform: rotate(-45deg);
    bottom: 0;
}

/* ============================================================
   3. Layout
   ============================================================ */
.container {
    display: flex;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: auto;
    padding: 20px;
    width: 100%;
    flex-grow: 1;
    align-items: flex-start;
    gap: 30px;
}

.content {
    flex: 1;
    min-width: 0;
    background-color: var(--color-surface);
    padding: 36px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(227, 235, 246, 0.8);
}

.sidebar {
    flex: 0 0 300px;
    background-color: var(--color-surface);
    color: var(--color-heading);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(227, 235, 246, 0.8);
    align-self: flex-start;
    position: sticky;
    top: 100px;
}

.sidebar h3 {
    margin-top: 0;
    font-size: 18px;
    text-align: center;
    border-bottom: 2px solid var(--color-blue-soft);
    padding-bottom: 12px;
    color: var(--color-heading);
    letter-spacing: -0.01em;
}

.sidebar h3 + ul {
    margin-top: 12px;
}

.sidebar ul {
    list-style-type: none;
    padding: 0;
    margin: 0 0 24px;
}

.sidebar ul li {
    margin-bottom: 6px;
}

.sidebar ul li a {
    text-decoration: none;
    color: var(--color-text-muted);
    font-weight: 500;
    display: block;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    transition: background-color 0.25s ease, color 0.25s ease, transform 0.2s ease;
}

.sidebar ul li a:hover {
    background-color: var(--color-blue-soft);
    color: var(--color-blue);
    transform: translateX(3px);
}

/* ============================================================
   4. Typography & Info Section
   ============================================================ */
h1 {
    margin-top: 0;
    font-size: 28px;
    margin-bottom: 20px;
    color: var(--color-heading);
    letter-spacing: -0.02em;
    line-height: 1.3;
}

#info {
    margin-top: 44px;
}

#info h2 {
    font-size: 22px;
    margin-bottom: 12px;
    color: var(--color-heading);
    letter-spacing: -0.01em;
}

#info h3 {
    font-size: 18px;
    margin-top: 24px;
    margin-bottom: 8px;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

#info p {
    font-size: 16px;
    margin-top: 10px;
    margin-bottom: 16px;
    color: var(--color-text-muted);
}

#info ol,
#info ul {
    padding-left: 0;
    margin-left: 0;
    list-style-position: inside;
}

#info ol li,
#info ul li {
    padding-left: 0;
    margin-left: 0;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

#info strong {
    color: var(--color-heading);
}

/* ============================================================
   5. Tables
   ============================================================ */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

th,
td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-heading);
    vertical-align: top;
}

th {
    background: linear-gradient(180deg, #eef5ff 0%, #e6f0ff 100%);
    font-weight: 600;
    color: #1e3a8a;
    white-space: nowrap;
}

tbody tr:hover td {
    background-color: var(--color-surface-soft);
}

tbody tr:last-child td {
    border-bottom: none;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    -webkit-overflow-scrolling: touch;
}

.product-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.product-table th,
.product-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.product-table th {
    background-color: #f0f7ff;
}

.product-table-image {
    width: 150px;
    height: 150px;
    object-fit: contain;
    transition: transform 0.2s;
    border-radius: var(--radius-md);
    background-color: var(--color-surface-soft);
}

.product-table-image:hover {
    transform: scale(1.05);
}

.table-amazon-button {
    display: inline-block;
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-hover) 100%);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-pill);
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(251, 146, 60, 0.3);
}

.table-amazon-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(249, 115, 22, 0.4);
}

.product-title {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.15em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    max-height: 2.8em;
    margin-bottom: 10px;
    text-overflow: ellipsis;
}

.product-title:hover {
    color: var(--color-accent-hover);
}

.number-cell {
    font-weight: bold;
    color: var(--color-blue);
    width: 50px;
}

.image-cell {
    width: 170px;
}

.button-cell {
    width: 150px;
}

/* ============================================================
   6. Calculator & Forms
   ============================================================ */
.calculator-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 28px;
    background: var(--color-surface-soft);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.calculator-container input {
    padding: 12px 14px;
    width: 100%;
    max-width: 100%;
    margin-bottom: 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-strong);
    font-size: 1em;
    color: var(--color-text);
    background-color: var(--color-surface);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.calculator-container input:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 4px var(--color-blue-soft);
}

.measurement-input {
    margin-bottom: 20px;
}

.measurement-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--color-heading);
}

.measurement-input input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    font-size: 16px;
}

.calc-btn {
    display: block;
    margin: 1.5rem auto;
    padding: 0.9rem 2.2rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.25s ease;
    width: fit-content;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.3);
}

.calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(22, 163, 74, 0.4);
}

.calc-btn:active {
    transform: translateY(0);
}

.result-container {
    margin-top: 20px;
    padding: 28px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
}

/* ============================================================
   7. Calculator Cards
   ============================================================ */
.calculator-cards {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.calculator-cards ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.calculator-cards li {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.calculator-cards li a {
    display: block;
    padding: 20px;
    color: var(--color-text);
    text-decoration: none;
    font-size: 1.1em;
    font-weight: bold;
    position: relative;
}

.calculator-cards li:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-blue-soft);
}

/* ============================================================
   8. Radio & Checkbox Customization
   ============================================================ */
.conversion-options {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    justify-content: center;
}

.radio-group {
    position: relative;
    cursor: pointer;
}

.radio-group input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.radio-group label {
    display: inline-block;
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    background-color: #f1f6fd;
    color: var(--color-text-muted);
    font-weight: 500;
    transition: all 0.25s ease;
    border: 2px solid transparent;
    cursor: pointer;
    user-select: none;
}

.radio-group input[type="radio"]:checked + label {
    background-color: var(--color-blue-soft);
    color: #1d4ed8;
    border-color: var(--color-blue);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.radio-group label:hover {
    background-color: #e6f0ff;
}

.radio-group input[type="radio"]:focus + label {
    outline: 2px solid var(--color-blue);
    outline-offset: 2px;
}

.radio-group input[type="radio"]:active + label {
    transform: scale(0.98);
}

.radio-group input[type="radio"]:disabled + label {
    opacity: 0.6;
    cursor: not-allowed;
}

.input-group input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-blue);
    border-radius: var(--radius-sm);
    margin-right: 10px;
    cursor: pointer;
    position: relative;
    background-color: var(--color-surface);
    transition: background-color 0.2s, border-color 0.2s;
}

.input-group input[type="checkbox"]:checked {
    background-color: var(--color-blue);
    border-color: var(--color-blue);
}

.input-group input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ============================================================
   9. Quiz UI
   ============================================================ */
.gender-selection {
    margin: 2rem 0;
    text-align: center;
}

.gender-btn {
    padding: 0.9rem 1.8rem;
    margin: 0 0.5rem;
    background-color: var(--color-surface);
    border: 2px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-text);
    transition: all 0.25s ease;
}

.gender-btn:hover {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.3);
}

.gender-btn.selected {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border-color: var(--color-primary);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.35);
}

.quiz-container {
    display: none;
    max-width: 800px;
    margin: 0 auto;
}

.question {
    margin: 1.5rem 0;
    padding: 1.8rem;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.4s ease-out;
}

.question h3 {
    color: var(--color-heading);
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.15rem;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1rem;
}

.option {
    padding: 1rem 1.2rem;
    background-color: #f4f8fe;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s ease;
    border-left: 4px solid transparent;
}

.option:hover {
    background-color: #eaf2fd;
    transform: translateX(5px);
    border-left-color: var(--color-blue);
}

.option.selected {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border-left-color: var(--color-primary-darker);
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.25);
}

#result {
    display: none;
    padding: 2rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-top: 2rem;
    box-shadow: var(--shadow-md);
    animation: fadeIn 0.6s ease-out;
}

.type-description {
    margin-top: 1.5rem;
    line-height: 1.65;
}

.type-description h3 {
    color: var(--color-primary-darker);
    margin: 1.2rem 0 0.5rem;
}

/* Progress */
.progress-container {
    width: 100%;
    background-color: #e6eefb;
    border-radius: var(--radius-pill);
    margin: 1rem 0;
    overflow: hidden;
}

.progress-bar {
    height: 0.6rem;
    background: linear-gradient(90deg, var(--color-primary) 0%, #4ade80 100%);
    border-radius: var(--radius-pill);
    width: 0%;
    transition: width 0.4s ease, background-color 0.3s ease;
}

/* Likert */
.likert-scale {
    display: flex;
    justify-content: space-between;
    margin: 1.5rem 0;
    gap: 10px;
}

.likert-option {
    flex: 1;
    padding: 12px 8px;
    text-align: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s ease;
    background-color: var(--color-surface-soft);
    color: var(--color-text-muted);
}

.likert-option:hover {
    background-color: var(--color-blue-soft);
    border-color: var(--color-blue);
    color: var(--color-blue);
}

.likert-option.selected {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border-color: var(--color-primary-dark);
    font-weight: bold;
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   10. Footer
   ============================================================ */
.footer {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.7);
    border-top: 1px solid var(--color-border);
    margin-top: 20px;
}

.footer p {
    padding: 3px;
    font-size: 0.85em;
    color: var(--color-text-muted);
}

.footer p a {
    color: var(--color-blue);
    text-decoration: none;
    padding: 10px;
}

/* ============================================================
   11. Responsive Breakpoints
   ============================================================ */

/* Tablet & small desktop */
@media (max-width: 900px) {
    .header {
        margin-bottom: 0;
        position: relative;
    }

    .logo {
        font-size: 20px;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 70px;
        right: 16px;
        background-color: var(--color-surface);
        width: 220px;
        box-shadow: var(--shadow-md);
        padding: 16px;
        border-radius: var(--radius-lg);
        border: 1px solid var(--color-border);
        z-index: 20;
    }

    .nav-links.active {
        display: block;
    }

    .nav-links a {
        display: block;
        padding: 10px;
    }

    .hamburger {
        display: block;
    }

    .container {
        flex-direction: column;
        padding: 15px;
        margin: 0;
        gap: 20px;
    }

    .sidebar {
        flex: 0 0 auto;
        margin-left: 0;
        margin-top: 0;
        width: 100%;
        max-width: 100%;
        order: 1;
        padding: 20px;
        position: static;
    }

    .content {
        order: 0;
        margin-bottom: 20px;
        padding: 24px;
        width: 100%;
        max-width: 100%;
    }

    h1 {
        font-size: 22px;
        margin-bottom: 15px;
    }

    .sidebar h3 {
        font-size: 16px;
    }

    #info h2 {
        font-size: 19px;
    }

    #info h3 {
        font-size: 1em;
    }

    label,
    select,
    button {
        font-size: 16px;
    }

    select,
    button {
        padding: 8px;
    }

    #result-name {
        font-size: 28px;
    }

    #common-link h2 {
        font-size: 18px;
    }

    #common-link li {
        flex: 1 0 calc(50% - 10px);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .calculator-cards {
        padding: 10px;
    }

    .calculator-cards ul {
        grid-template-columns: 1fr;
    }

    .size-option {
        padding: 8px 15px;
        min-width: 70px;
    }

    .primary-size {
        font-size: 2.5em;
    }

    /* Card-style product table */
    .product-table thead {
        display: none;
    }

    .product-table,
    .product-table tbody,
    .product-table tr,
    .product-table td {
        display: block;
        width: 100%;
        text-align: center;
    }

    .product-table tr {
        margin-bottom: 30px;
        border: 1px solid var(--color-border);
        border-radius: var(--radius-lg);
        padding: 18px;
        box-shadow: var(--shadow-sm);
        background-color: var(--color-surface);
    }

    .product-table td {
        border: none;
        padding: 8px;
    }

    .number-cell {
        font-size: 1.2em;
        color: var(--color-accent-hover);
        margin-bottom: 10px;
    }

    .number-cell::before {
        content: "#";
    }

    .image-cell {
        margin: 0 auto;
    }

    .product-table-image {
        width: 200px;
        height: 200px;
        margin: 0 auto;
    }

    .product-title {
        font-size: 1.1em;
        margin: 15px auto;
        max-width: 300px;
    }

    .button-cell {
        margin-top: 15px;
    }

    .table-amazon-button {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
        padding: 12px 20px;
    }

    /* Quiz mobile */
    .gender-selection {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .gender-btn {
        margin: 0;
        width: 100%;
        padding: 1rem;
    }

    .options {
        flex-direction: column;
    }

    .option {
        padding: 1rem;
    }

    .question {
        padding: 1.2rem;
        margin: 1.2rem 0;
    }

    #result {
        padding: 1.5rem;
    }

    .calc-btn {
        width: 100%;
        padding: 1rem;
    }

    .likert-scale {
        flex-direction: column;
        gap: 8px;
    }

    .likert-option {
        padding: 10px;
    }

    .calculator-container {
        padding: 20px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .product-table-image {
        width: 150px;
        height: 150px;
    }

    .product-table tr {
        padding: 12px;
    }

    .product-title {
        font-size: 1em;
        max-width: 250px;
    }

    .content {
        padding: 18px;
    }

    h1 {
        font-size: 20px;
    }
}

/* Tablet quiz layout (optional two-column options) */
@media (min-width: 769px) and (max-width: 1024px) {
    .options {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
}
