/* ========== Reset & Base ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overscroll-behavior: none;
}

body {
    background: #2b180d;
    color: rgba(255, 248, 240, 0.9);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    min-height: 100vh;
    padding: clamp(32px, 8vw, 48px) clamp(24px, 8vw, 48px);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ========== Layout - 4pt grid ========== */
.form-container {
    width: min(100%, 512px);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.referral-header {
    text-align: center;
    margin-bottom: 32px;
}

.title-row {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.title-row .logo {
    height: clamp(48px, 10vw, 80px);
    width: auto;
}

/* ========== 3D Stroke Title ========== */
.title-3d {
    position: relative;
    display: inline-block;
}

.title-3d .stroke-layer {
    position: relative;
    z-index: 1;
    display: inline-block;
    white-space: nowrap;
    font-size: clamp(48px, 10vw, 80px);
    font-weight: 800;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    line-height: 1;
    vertical-align: bottom;
}

.title-3d .stroke-layer .word-double,
.title-3d .stroke-layer .word-hyphen,
.title-3d .stroke-layer .word-take {
    background: linear-gradient(135deg, rgb(184, 115, 51), rgb(205, 127, 50), rgb(160, 82, 45));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title-3d .stroke-shadow {
    position: absolute;
    top: 0;
    left: 0;
    white-space: nowrap;
    font-size: clamp(48px, 10vw, 80px);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #2b180d;
    -webkit-text-stroke: 2px rgb(255, 102, 0);
    paint-order: stroke fill;
    text-transform: uppercase;
    z-index: -1;
    transform: translate(0, 0);
}

.referral-header .subtitle {
    font-size: clamp(16px, 3vw, 20px);
    font-weight: 500;
    color: rgba(255, 248, 240, 0.9);
    margin-bottom: 8px;
}

.referral-header .description {
    font-size: clamp(12px, 2vw, 16px);
    color: rgba(255, 248, 240, 0.5);
    font-style: italic;
    max-width: 400px;
    margin: 0 auto;
    line-height: 1.5;
}

/* ========== Form Structure ========== */
.form-section-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 248, 240, 0.5);
    margin-top: 20px;
    margin-bottom: 8px;
    width: 100%;
    text-align: center;
    transition: all 0.2s ease;
}

.form-section-group.is-active .form-section-label {
    color: rgba(210, 140, 80, 0.8);
    letter-spacing: 0.16em;
    transform: scale(1.04);
}

.form-section-group:first-child .form-section-label {
    margin-top: 0;
}

.form-section-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.form-field.full-width {
    width: 100%;
}

.input-container {
    position: relative;
    width: 100%;
}

.form-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    margin: 24px 0;
}

/* ========== Form Inputs ========== */
.form-input {
    width: 100%;
    height: 48px;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 0 20px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    font-weight: 400;
    letter-spacing: -0.01em;
    transition: all 0.2s ease;
    outline: none;
}

.form-input::placeholder {
    color: rgba(255, 248, 240, 0.32);
}

.form-input:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.16);
}

.form-input-dashed {
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}

.form-input-dashed::placeholder {
    color: rgba(255, 248, 240, 0.24);
}

.form-input-dashed:focus {
    border-style: solid;
}

.form-input-dashed.is-valid {
    border-style: dashed;
    background: rgba(210, 140, 80, 0.06);
}

/* ========== Field Status Indicator ========== */
.field-status {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%) scale(1);
    width: 8px;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.12);
    transition: all 0.2s ease;
    pointer-events: none;
}

@keyframes checkPop {
    0% { transform: translateY(-50%) scale(0); }
    60% { transform: translateY(-50%) scale(1.2); }
    100% { transform: translateY(-50%) scale(1); }
}

.field-status.has-content {
    width: 20px;
    height: 20px;
    border-radius: 10px;
    background: url('checkmark.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    animation: checkPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ========== Input Valid State (10% accent) ========== */
.form-input.is-valid {
    border-color: rgba(210, 130, 70, 0.48);
    background: rgba(210, 130, 70, 0.04);
}

/* ========== Submit Button ========== */
@keyframes buttonReady {
    0% { transform: scale(1); }
    50% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

.submit-button {
    margin-top: 24px;
    padding: 16px 48px;
    width: auto;
    min-width: 200px;
    height: 52px;
    background: linear-gradient(135deg, rgb(255, 102, 0), rgb(204, 115, 51));
    border: 2px solid transparent;
    border-radius: 28px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.submit-button:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: 0 8px 32px rgba(255, 102, 0, 0.24);
}

.submit-button:disabled {
    opacity: 0.48;
    cursor: not-allowed;
    pointer-events: none;
}

.submit-button.just-enabled {
    animation: buttonReady 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.submit-button.success {
    background: linear-gradient(135deg, rgb(72, 180, 97), rgb(56, 142, 60));
    pointer-events: none;
}

.submit-button.success::before {
    content: '✓';
    margin-right: 8px;
    font-weight: 700;
}

.error-message {
    font-size: 12px;
    color: rgb(220, 80, 80);
    text-align: center;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.error-message.visible {
    opacity: 1;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Disclaimer ========== */
.form-disclaimer {
    font-size: 12px;
    color: rgba(255, 248, 240, 0.4);
    text-align: center;
    font-style: italic;
    margin-top: 20px;
    line-height: 1.5;
}

/* ========== Confirmation State ========== */
.form-field {
    position: relative;
}

.confirm-value {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 500;
    color: rgba(255, 248, 240, 0.9);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.confirm-value.is-email {
    color: rgba(210, 140, 80, 0.9);
}

.form-state-confirm .form-input {
    opacity: 0;
    pointer-events: none;
}

.form-state-confirm .field-status {
    opacity: 0;
}

.form-state-confirm .confirm-value {
    opacity: 1;
}

.form-state-confirm .form-divider {
    opacity: 0.4;
}

.form-state-confirm .form-disclaimer {
    opacity: 0;
}
