:root {
    --bg-start: rgb(8, 6, 12);
    --bg-mid: rgb(20, 12, 32);
    --bg-end: rgb(37, 22, 58);
    --line: rgba(151, 125, 198, 0.7);
    --text: rgb(224, 216, 246);
    --btn-text: rgb(206, 191, 238);
    --btn-hover-text: rgb(243, 236, 255);
    --muted: rgb(176, 162, 210);
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    margin: 0;
    background: linear-gradient(150deg, var(--bg-start) 0%, var(--bg-mid) 52%, var(--bg-end) 100%);
    color: var(--text);
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

#logo {
    font-size: 120%;
    color: var(--text);
    margin: 0 0 10vh;
}

#main-container {
    display: flex;
    flex-direction: column;
    width: 80%;
    min-height: 70%;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(151, 125, 198, 0.28);
    border-radius: 16px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

.page {
    width: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.page.active {
    display: flex;
}

.main-btn {
    width: min(460px, 50%);
    min-height: 64px;
    color: var(--btn-text);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px;
    cursor: pointer;
    border: 1px dashed var(--line);
    border-radius: 10em;
    background: rgba(255, 255, 255, 0.03);
}

.main-btn:hover {
    border-color: rgba(205, 180, 248, 0.95);
    background: rgba(173, 137, 242, 0.12);
    color: var(--btn-hover-text);
}

button.main-btn {
    font: inherit;
}

.main-btn p {
    margin: 0;
}

.muted {
    color: var(--muted);
    margin: 0 0 10px;
}

.form-box {
    width: min(460px, 80%);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-box input {
    width: 100%;
    height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(151, 125, 198, 0.6);
    background: rgba(255, 255, 255, 0.04);
    color: rgb(231, 224, 248);
    padding: 0 12px;
    box-sizing: border-box;
}

.form-box input::placeholder {
    color: rgb(150, 139, 180);
}

.draw-topbar {
    width: min(920px, 92%);
    display: flex;
    justify-content: flex-start;
    margin-bottom: 8px;
}

.ghost-btn {
    border: 1px solid rgba(151, 125, 198, 0.6);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--btn-text);
    min-height: 38px;
    padding: 0 16px;
    cursor: pointer;
}

.ghost-btn:hover {
    border-color: rgba(205, 180, 248, 0.95);
    background: rgba(173, 137, 242, 0.12);
    color: var(--btn-hover-text);
}

.draw-board {
    width: min(920px, 92%);
    height: min(70vh, 620px);
    border: 2px dashed rgba(167, 140, 216, 0.8);
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    --pan-x: 0px;
    --pan-y: 0px;
    --grid-step-x: 128px;
    --grid-step-y: 208px;
    touch-action: none;
    background:
        radial-gradient(circle, rgba(228, 214, 255, 0.48) 1.6px, transparent 2px),
        radial-gradient(circle at 20% 18%, rgba(213, 198, 255, 0.08), transparent 40%),
        radial-gradient(circle at 78% 74%, rgba(173, 137, 242, 0.1), transparent 38%),
        rgba(255, 255, 255, 0.02);
    background-size:
        var(--grid-step-x) var(--grid-step-y),
        100% 100%,
        100% 100%,
        100% 100%;
    background-position:
        calc(50% + var(--pan-x) + (var(--grid-step-x) / 2)) calc(50% + var(--pan-y) + (var(--grid-step-y) / 2)),
        center,
        center,
        center;
}

.draw-hint {
    margin-top: 8px;
}

.draw-plus {
    position: absolute;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 1px dashed rgba(205, 180, 248, 0.95);
    background: rgba(173, 137, 242, 0.14);
    color: rgb(242, 235, 255);
    font-size: 2.2rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 8;
}

.draw-plus[hidden] {
    display: none !important;
}

.card-node {
    width: 92px;
    height: 149px;
    border-radius: 14px;
    border: 1px solid rgba(205, 180, 248, 0.88);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(173, 137, 242, 0.12) 100%);
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgb(236, 227, 255);
    -webkit-user-select: none;
    user-select: none;
    touch-action: auto;
    box-shadow: 0 12px 24px rgba(10, 8, 20, 0.35);
    pointer-events: auto;
}

.card-node p {
    margin: 0;
    font-size: 0.9rem;
}

.new-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 3, 8, 0.62);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    z-index: 30;
}

.new-modal[hidden] {
    display: none !important;
}

.new-modal-panel {
    width: min(460px, 90vw);
    border: 1px solid rgba(151, 125, 198, 0.5);
    border-radius: 18px;
    padding: 18px 14px;
    box-sizing: border-box;
    background: linear-gradient(165deg, rgba(17, 12, 30, 0.95) 0%, rgba(35, 22, 55, 0.95) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.new-modal-panel h3 {
    margin: 4px 0 6px;
    font-weight: 600;
}

@media (max-width: 768px) {
    #main-container {
        width: 92%;
        min-height: 84%;
    }

    .main-btn {
        width: min(460px, 82%);
    }

    .draw-board {
        height: 64vh;
    }
}
