:root {
    --ink: #050607;
    --stone: #0b0d0f;
    --panel: #101316;
    --panel-deep: #090b0d;
    --line: #32373a;
    --line-soft: rgba(167, 174, 176, 0.16);
    --gold: #d6b66f;
    --gold-bright: #f2d58c;
    --gold-dark: #6b5429;
    --ivory: #eee8dc;
    --muted: #8c9192;
    --cyan: #69c8d5;
    --error: #e77767;
    --success: #68d89a;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
}

html,
body {
    min-height: 100%;
}

body {
    min-width: 320px;
    margin: 0;
    overflow-x: hidden;
    color: var(--ivory);
    background: var(--ink);
    font-family: "Malgun Gothic", "Apple SD Gothic Neo", Arial, sans-serif;
}

button,
input {
    font: inherit;
}

.join-page {
    position: relative;
    isolation: isolate;
    display: grid;
    min-height: 100vh;
    place-items: center;
    overflow: hidden;
    padding: 44px 24px;
    background:
        linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.01) 1px, transparent 1px),
        repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 7px),
        radial-gradient(circle at 50% 47%, #15191b 0, #080a0b 44%, #030405 78%);
    background-size: 72px 72px, 72px 72px, auto, auto;
}

.join-page::before,
.join-page::after {
    position: absolute;
    z-index: -2;
    inset: 0;
    content: "";
    pointer-events: none;
}

.join-page::before {
    background:
        linear-gradient(90deg, transparent 49.9%, rgba(214, 182, 111, 0.07) 50%, transparent 50.1%),
        linear-gradient(transparent 49.9%, rgba(214, 182, 111, 0.035) 50%, transparent 50.1%);
    mask-image: radial-gradient(circle, #000 0, transparent 70%);
}

.join-page::after {
    background: radial-gradient(circle at center, transparent 44%, rgba(0, 0, 0, 0.72) 100%);
}

.ambient {
    position: absolute;
    z-index: -1;
    width: 540px;
    height: 540px;
    border: 1px solid rgba(214, 182, 111, 0.055);
    opacity: 0.46;
    rotate: 45deg;
}

.ambient::before,
.ambient::after {
    position: absolute;
    inset: 40px;
    border: 1px solid rgba(214, 182, 111, 0.04);
    content: "";
}

.ambient::after {
    inset: 90px;
}

.ambient-left {
    top: 18%;
    left: -390px;
}

.ambient-right {
    right: -390px;
    bottom: 18%;
}

.join-container {
    position: relative;
    width: min(100%, 840px);
    padding: 39px 46px 23px;
    border: 1px solid #34383a;
    background:
        linear-gradient(110deg, rgba(255, 255, 255, 0.018), transparent 36%),
        linear-gradient(180deg, rgba(17, 20, 22, 0.985), rgba(7, 9, 10, 0.995));
    box-shadow:
        0 30px 90px rgba(0, 0, 0, 0.72),
        inset 0 0 0 5px rgba(255, 255, 255, 0.012),
        inset 0 1px rgba(255, 255, 255, 0.05);
}

.join-container::before,
.join-container::after {
    position: absolute;
    left: 25px;
    right: 25px;
    height: 1px;
    content: "";
    background: linear-gradient(90deg, transparent, var(--gold-dark) 14%, var(--gold) 50%, var(--gold-dark) 86%, transparent);
    opacity: 0.66;
}

.join-container::before {
    top: 14px;
}

.join-container::after {
    bottom: 14px;
}

.shell-corner {
    position: absolute;
    width: 22px;
    height: 22px;
    border-color: #827044;
    opacity: 0.7;
}

.shell-corner-tl { top: 8px; left: 8px; border-top: 1px solid; border-left: 1px solid; }
.shell-corner-tr { top: 8px; right: 8px; border-top: 1px solid; border-right: 1px solid; }
.shell-corner-bl { bottom: 8px; left: 8px; border-bottom: 1px solid; border-left: 1px solid; }
.shell-corner-br { right: 8px; bottom: 8px; border-right: 1px solid; border-bottom: 1px solid; }

.join-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    text-align: left;
}

.brand-mark {
    position: relative;
    display: grid;
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
    place-items: center;
    rotate: 45deg;
    border: 1px solid #9b7d3a;
    background: linear-gradient(135deg, #17191a, #080909 60%);
    box-shadow:
        inset 0 0 0 5px #080909,
        inset 0 0 0 6px rgba(214, 182, 111, 0.18),
        0 0 24px rgba(214, 182, 111, 0.07);
}

.brand-mark::before,
.brand-mark::after {
    position: absolute;
    background: var(--gold-dark);
    content: "";
}

.brand-mark::before { left: -10px; width: 9px; height: 1px; }
.brand-mark::after { top: -10px; width: 1px; height: 9px; }

.brand-mark span {
    color: var(--gold-bright);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 31px;
    font-weight: 700;
    text-shadow: 0 0 12px rgba(242, 213, 140, 0.25);
    rotate: -45deg;
}

.brand-kicker,
.brand-subtitle,
.section-label {
    margin: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.32em;
}

.brand-kicker { color: var(--cyan); }

.brand-copy h1 {
    margin: 6px 0 4px;
    color: #f2ede4;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(30px, 6vw, 41px);
    font-weight: 600;
    letter-spacing: 0.055em;
    line-height: 1;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.8);
}

.brand-subtitle {
    color: #777c7e;
    letter-spacing: 0.36em;
}

.brand-divider {
    display: grid;
    grid-template-columns: 1fr 9px 1fr;
    align-items: center;
    gap: 11px;
    margin: 28px 0 22px;
}

.brand-divider span {
    height: 1px;
    background: linear-gradient(90deg, transparent, #66562f);
}

.brand-divider span:last-child { background: linear-gradient(90deg, #66562f, transparent); }

.brand-divider i {
    width: 7px;
    height: 7px;
    margin: auto;
    border: 1px solid #b29552;
    background: #111315;
    box-shadow: 0 0 9px rgba(214, 182, 111, 0.28);
    rotate: 45deg;
}

.registration-panel {
    position: relative;
    padding: 26px 29px 24px;
    border: 1px solid #353a3c;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.02), transparent 32%),
        rgba(8, 10, 11, 0.82);
    box-shadow:
        inset 0 1px rgba(255, 255, 255, 0.035),
        inset 0 0 35px rgba(0, 0, 0, 0.28);
}

.registration-panel::before {
    position: absolute;
    top: -1px;
    left: 29px;
    width: 112px;
    height: 1px;
    background: linear-gradient(90deg, var(--gold), transparent);
    content: "";
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-label {
    color: #a38a50;
    letter-spacing: 0.24em;
}

.panel-heading h2 {
    margin: 6px 0 0;
    color: #f4f0e8;
    font-family: Georgia, "Malgun Gothic", serif;
    font-size: 25px;
    font-weight: 600;
    letter-spacing: -0.04em;
}

.security-seal {
    position: relative;
    display: grid;
    width: 39px;
    height: 39px;
    place-items: center;
    border: 1px solid #3a4143;
    background: #0b0e10;
    rotate: 45deg;
}

.shield-core {
    width: 14px;
    height: 17px;
    border: 1px solid #c1a55f;
    background: linear-gradient(135deg, rgba(214, 182, 111, 0.18), transparent);
    clip-path: polygon(50% 0, 100% 20%, 88% 73%, 50% 100%, 12% 73%, 0 20%);
    rotate: -45deg;
}

.join-guide {
    margin: 14px 0 20px;
    color: #969b9d;
    font-size: 13px;
    line-height: 1.7;
}

.join-guide strong { color: #d9c38d; }

#joinForm {
    display: grid;
    gap: 13px;
}

.form-section {
    min-width: 0;
    margin: 0;
    padding: 16px;
    border: 1px solid #303638;
    background: rgba(6, 8, 9, 0.62);
}

.form-section legend {
    padding: 0 9px 0 0;
    color: #d8c89f;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.form-section legend span {
    display: inline-grid;
    width: 25px;
    height: 19px;
    margin-right: 7px;
    place-items: center;
    border: 1px solid #67552e;
    color: var(--gold);
    font-family: Georgia, serif;
    font-size: 10px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
}

.form-lower-grid {
    display: grid;
    grid-template-columns: minmax(190px, 0.72fr) minmax(0, 1.4fr);
    gap: 13px;
}

.form-row {
    display: grid;
    align-content: start;
    gap: 7px;
    min-width: 0;
}

.form-row-wide { grid-column: 1 / -1; }

.form-row > label {
    color: #9c9fa0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.17em;
}

.form-row > label small {
    margin-left: 7px;
    color: #747a7c;
    font-family: "Malgun Gothic", sans-serif;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0;
}

.form-row input {
    width: 100%;
    height: 45px;
    min-width: 0;
    padding: 0 14px;
    border: 1px solid #343a3d;
    border-radius: 0;
    outline: none;
    color: #ece8df;
    background: linear-gradient(180deg, #090b0d, #0d1012);
    box-shadow: inset 0 1px 6px rgba(0, 0, 0, 0.72);
    font-size: 13px;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.form-row input::placeholder { color: #555b5e; }

.form-row input:hover { border-color: #485053; }

.form-row input:focus {
    border-color: #907a45;
    box-shadow:
        inset 0 1px 6px rgba(0, 0, 0, 0.72),
        0 0 0 1px rgba(214, 182, 111, 0.08),
        0 0 18px rgba(214, 182, 111, 0.055);
}

.input-with-button {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 8px;
}

.check-button,
.captcha-refresh-button {
    height: 45px;
    padding: 0 11px;
    border: 1px solid #5e543a;
    color: #d6c28f;
    background: linear-gradient(180deg, #191812, #0e100f);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.check-button:hover,
.captcha-refresh-button:hover {
    border-color: var(--gold);
    color: var(--gold-bright);
    background: #19170e;
}

.check-button:focus-visible,
.captcha-refresh-button:focus-visible,
.join-button:focus-visible {
    outline: 1px solid var(--cyan);
    outline-offset: 3px;
}

button:disabled {
    cursor: wait;
    opacity: 0.58;
}

.field-message {
    min-height: 0;
    margin: -1px 0 0;
    color: var(--error);
    font-size: 11px;
    line-height: 1.45;
}

.field-message:empty { display: none; }
.field-message.success { color: var(--success); }

.captcha-inline {
    display: grid;
    grid-template-columns: 128px minmax(88px, 1fr) 76px;
    gap: 7px;
}

.captcha-inline img {
    display: block;
    width: 128px;
    height: 45px;
    object-fit: cover;
    border: 1px solid #5e543a;
    background: #f0eee7;
    filter: saturate(0.72) contrast(1.04);
}

.captcha-inline input { padding-inline: 10px; text-align: center; letter-spacing: 0.08em; }
.captcha-refresh-button { padding-inline: 7px; }

.agreement-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 24px;
    padding: 3px 2px;
}

.agreement-group label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #b8babb;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
}

.agreement-group input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

.check-box {
    position: relative;
    display: inline-block;
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    border: 1px solid #5b6264;
    background: #090c0d;
    rotate: 45deg;
}

.agreement-group input:checked + .check-box {
    border-color: #b5964d;
    background: #282112;
    box-shadow: 0 0 8px rgba(214, 182, 111, 0.18);
}

.agreement-group input:checked + .check-box::after {
    position: absolute;
    top: 2px;
    left: 4px;
    width: 4px;
    height: 7px;
    border-right: 1px solid var(--gold-bright);
    border-bottom: 1px solid var(--gold-bright);
    content: "";
    transform: rotate(0deg);
}

.agreement-group input:focus-visible + .check-box {
    outline: 1px solid var(--cyan);
    outline-offset: 3px;
}

.agreement-group small {
    margin-left: 5px;
    color: #7e8587;
    font-size: 10px;
}

.join-button {
    position: relative;
    display: grid;
    width: 100%;
    height: 55px;
    place-items: center;
    overflow: hidden;
    border: 1px solid #9f7e36;
    color: #f6e5b6;
    background:
        linear-gradient(110deg, transparent 0 25%, rgba(255, 235, 174, 0.07) 45%, transparent 65%),
        linear-gradient(180deg, #2a2518, #15140f);
    box-shadow:
        inset 0 1px rgba(255, 238, 190, 0.12),
        0 8px 24px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: border-color 160ms ease, color 160ms ease, filter 160ms ease;
}

.join-button::before,
.join-button::after {
    position: absolute;
    top: 50%;
    width: 65px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #80662f);
    content: "";
}

.join-button::before { left: 24px; }
.join-button::after { right: 24px; transform: rotate(180deg); }

.join-button > span {
    align-self: end;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.25;
}

.join-button > small {
    align-self: start;
    color: #978357;
    font-family: Georgia, serif;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.24em;
}

.join-button:hover {
    border-color: var(--gold-bright);
    color: #fff1c7;
    filter: brightness(1.08);
}

.security-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
    color: #676d6f;
    text-align: center;
}

.security-note p { margin: 0; font-size: 10px; line-height: 1.55; }

.note-gem {
    width: 6px;
    height: 6px;
    border: 1px solid #6c875f;
    background: #111713;
    rotate: 45deg;
}

.portal-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 17px;
    color: #4f5557;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 8px;
    letter-spacing: 0.23em;
}

.portal-footer i {
    width: 4px;
    height: 4px;
    border: 1px solid #6a5931;
    rotate: 45deg;
}

@media (max-width: 760px) {
    .join-page { padding: 22px 14px; }
    .join-container { padding: 35px 24px 21px; }
    .registration-panel { padding: 24px 20px 21px; }
    .form-lower-grid { grid-template-columns: 1fr; }
}

@media (max-width: 580px) {
    .join-page { display: block; padding: 12px 8px; overflow: hidden; }
    .join-container { padding: 31px 13px 20px; }
    .join-header { gap: 19px; }
    .brand-mark { width: 52px; height: 52px; flex-basis: 52px; }
    .brand-mark span { font-size: 26px; }
    .brand-copy h1 { font-size: 29px; }
    .brand-kicker { font-size: 8px; letter-spacing: 0.2em; }
    .brand-subtitle { font-size: 8px; letter-spacing: 0.2em; }
    .brand-divider { margin: 24px 0 19px; }
    .registration-panel { padding: 22px 13px 19px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-row-wide { grid-column: auto; }
    .captcha-inline { grid-template-columns: 116px minmax(0, 1fr); }
    .captcha-inline img { width: 116px; }
    .captcha-refresh-button { grid-column: 1 / -1; height: 38px; }
    .agreement-group { align-items: flex-start; flex-direction: column; }
    .join-button::before,
    .join-button::after { width: 34px; }
    .join-button::before { left: 13px; }
    .join-button::after { right: 13px; }
    .security-note { align-items: flex-start; text-align: left; }
    .portal-footer { font-size: 7px; letter-spacing: 0.13em; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
