@import url('https://fonts.googleapis.com/css2?family=Google+Sans+Code:ital,wght@0,300..800;1,300..800&display=swap');

:root {
    --md-sys-color-primary: #0061a4;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #d1e4ff;
    --md-sys-color-on-primary-container: #001d36;

    --md-sys-color-secondary-container: #d7e3f7;
    --md-sys-color-on-secondary-container: #101c2b;

    --md-sys-color-error: #ba1a1a;
    --md-sys-color-error-container: #ffdad6;
    --md-sys-color-on-error-container: #410002;

    --md-sys-color-success-container: #c4eed0;
    --md-sys-color-on-success-container: #00210e;

    --md-sys-color-background: #fdfcff;
    --md-sys-color-surface: #fdfcff;
    --md-sys-color-surface-container: #f0f4f9;
    --md-sys-color-on-surface: #1a1c1e;
    --md-sys-color-on-surface-variant: #43474e;
    --md-sys-color-outline: #73777f;
    --md-sys-color-outline-focus: #0061a4;

    --border-radius-lg: 28px;
    --border-radius-md: 12px;
    --border-radius-pill: 20px;
    color-scheme: light;
}

* { box-sizing: border-box; }

body {
    font-family: 'Google Sans', sans-serif;
    background-color: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: clamp(16px, 3vw, 24px);
}

.card {
    background: var(--md-sys-color-surface);
    border-radius: var(--border-radius-lg);
    padding: clamp(20px, 4vw, 36px);
    width: 100%;
    max-width: 520px;
    box-shadow: 0 0 0 0.8px #E0E0E0 inset;
}

h1 {
    font-size: clamp(24px, 3vw, 30px);
    font-weight: 400;
    margin: 0 0 8px 0;
    color: var(--md-sys-color-on-surface);
}

.subtitle {
    font-size: 16px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 32px;
    line-height: 1.3;
}

.subtitlelink {
    color: var(--md-sys-color-primary);
    text-decoration: none;
    font-weight: 500;
}

.subtitlelink:hover { text-decoration: underline; }

.steps {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    padding: clamp(14px, 3vw, 20px) clamp(16px, 4vw, 24px);
    border-radius: var(--border-radius-md);
    margin-bottom: 32px;
    font-size: 15px;
    line-height: 1.5;
}

.steps strong {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
}

.steps ol {
    margin: 0;
    padding-left: 20px;
}

.steps li { margin-bottom: 4px; }

.steps a {
    color: var(--md-sys-color-primary);
    text-decoration: none;
    font-weight: 500;
}

.steps a:hover { text-decoration: underline; }

form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.input-group {
    position: relative;
    font-family: 'Google Sans Code', monospace;
}

.input-group input {
    width: 100%;
    padding: 16px;
    background: transparent;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 4px;
    font-size: 16px;
    color: var(--md-sys-color-on-surface);
    outline: none;
    transition: border-color 0.2s;
}

.input-group label {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--md-sys-color-surface);
    padding: 0 4px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 16px;
    transition: 0.2s ease all;
    pointer-events: none;
}

.input-group input:focus {
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    padding: 15px;
}

.input-group input:focus ~ label {
    color: var(--md-sys-color-primary);
}

.input-group input:focus ~ label,
.input-group input:not(:placeholder-shown) ~ label {
    top: 0;
    font-size: 12px;
    font-weight: 500;
}

button {
    width: 100%;
    height: 44px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    border-radius: var(--border-radius-pill);
    font-family: 'Google Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.1px;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 1px 3px 1px rgba(0,0,0,0.15);
    opacity: 0.92;
}

button:active { transform: scale(0.98); }

button:disabled {
    background: rgba(28, 27, 31, 0.12);
    color: rgba(28, 27, 31, 0.38);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.result {
    margin-top: 24px;
    padding: 16px;
    border-radius: var(--border-radius-md);
    font-size: 14px;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.success {
    background-color: var(--md-sys-color-success-container);
    color: var(--md-sys-color-on-success-container);
}

.error {
    background-color: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.token-box {
    background: rgba(255, 255, 255, 0.6);
    padding: 12px;
    border-radius: 8px;
    font-family: 'Google Sans Code', monospace;
    font-size: 12px;
    margin: 12px 0;
    word-break: break-all;
    border: 1px dashed rgba(0,0,0,0.2);
    max-height: 100px;
    overflow-y: auto;
}

.copy-btn {
    background: transparent;
    color: var(--md-sys-color-primary);
    border: 1px solid var(--md-sys-color-outline);
    width: auto;
    display: inline-flex;
    margin-top: 0;
    padding: 0 24px;
}

.copy-btn:hover {
    background: var(--md-sys-color-primary-container);
    border-color: transparent;
    color: var(--md-sys-color-on-primary-container);
}

small {
    display: block;
    margin-top: 8px;
    opacity: 0.8;
}

@media (max-width: 600px) {
    body {
        padding: 0;
        background: var(--md-sys-color-surface);
    }
    .card {
        box-shadow: none;
        border-radius: 0;
        padding: 22px;
        max-width: 100%;
        min-height: 100vh;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --md-sys-color-primary: #9ccaff;
        --md-sys-color-on-primary: #00325a;
        --md-sys-color-primary-container: #00497d;
        --md-sys-color-on-primary-container: #d1e4ff;

        --md-sys-color-secondary-container: #2a3342;
        --md-sys-color-on-secondary-container: #d7e3f7;

        --md-sys-color-error: #ffb4ab;
        --md-sys-color-error-container: #93000a;
        --md-sys-color-on-error-container: #ffdad6;

        --md-sys-color-success-container: #0f5132;
        --md-sys-color-on-success-container: #c4eed0;

        --md-sys-color-background: #101419;
        --md-sys-color-surface: #14181d;
        --md-sys-color-surface-container: #1b2026;
        --md-sys-color-on-surface: #e2e2e6;
        --md-sys-color-on-surface-variant: #c2c7cf;
        --md-sys-color-outline: #8c9198;
        --md-sys-color-outline-focus: #9ccaff;
        color-scheme: dark;
    }

    .card {
        box-shadow: 0 0 0 0.8px rgba(255, 255, 255, 0.06) inset;
    }

    .input-group input {
        border-color: rgba(255, 255, 255, 0.2);
    }

    .input-group label {
        background-color: var(--md-sys-color-surface);
    }

    button:disabled {
        background: rgba(226, 226, 230, 0.12);
        color: rgba(226, 226, 230, 0.38);
    }

    .token-box {
        background: rgba(20, 24, 29, 0.7);
        border-color: rgba(255, 255, 255, 0.2);
    }
}
