.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.popup-overlay.alert-overlay {
    z-index: 9998;
}

.popup-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.popup-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 201;
    background: #1e1c18;
    border: 2px solid rgba(210, 170, 120, 0.7);
    border-radius: 20px 20px 0 0;
    padding: 0 24px 32px;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    touch-action: none;
}

.popup-sheet.alert-sheet {
    z-index: 9999;
}

.popup-sheet.show {
    transform: translateY(0);
}

@media (min-width: 500px) {
    .popup-sheet {
        width: 500px;
        left: 0;
        right: 0;
        margin-left: auto;
        margin-right: auto;
    }
}

.popup-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 301;
    background: #1e1c18;
    border: 2px solid rgba(210, 170, 120, 0.7);
    border-radius: 20px;
    width: 85%;
    max-width: 320px;
    min-width: 260px;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.popup-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.popup-handle {
    width: 40px;
    height: 5px;
    border-radius: 3px;
    background: rgba(210, 170, 120, 0.3);
    margin: 12px auto 24px;
    cursor: grab;
}

.popup-title {
    font-size: 18px;
    font-weight: 700;
    color: rgba(210, 170, 120, 0.95);
    margin-bottom: 12px;
}

.popup-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.popup-icon svg {
    width: 26px;
    height: 26px;
}

.popup-body {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.7;
    flex: 1;
    white-space: pre-line;
}

.popup-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 20px;
    justify-content: center;
}

.popup-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1.5px solid rgba(150, 110, 70, 0.4);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.popup-checkbox.checked {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.35);
}

.popup-checkbox svg {
    width: 12px;
    height: 12px;
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s;
}

.popup-checkbox.checked svg {
    opacity: 1;
}

.popup-checkbox-label {
    font-size: 12px;
    color: #7a6050;
    cursor: pointer;
}

.popup-confirm-btn {
    flex: 1;
    height: 48px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(210, 170, 120, 0.85), rgba(180, 140, 90, 0.85));
    color: #1a1208;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.popup-cancel-btn {
    flex: 1;
    height: 48px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.modal-wrap {
    position: fixed;
    inset: 0;
    z-index: 201;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    padding: 32px 24px;
}

.modal-wrap.show {
    pointer-events: auto;
}

.modal-box {
    width: 100%;
    max-width: 420px;
    max-height: 80vh;
    background: #1e1e22;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.modal-wrap.show .modal-box {
    transform: scale(1);
    opacity: 1;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.modal-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    font-size: 16px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-body::-webkit-scrollbar {
    display: none;
}

.modal-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.modal-row:last-child {
    border-bottom: none;
}

.modal-row-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
}

.modal-row-value {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.modal-row-value.price {
    color: #FF6B6B;
    font-weight: 900;
}

/* ─── Nickname Popup ─── */
.nick-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 210;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.nick-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.nick-wrap {
    position: fixed;
    inset: 0;
    z-index: 211;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    padding: 32px 24px;
}

.nick-wrap.show {
    pointer-events: auto;
}

.nick-box {
    width: 100%;
    max-width: 320px;
    background: #1e1e22;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 28px 24px 24px;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    text-align: center;
}

.nick-wrap.show .nick-box {
    transform: scale(1);
    opacity: 1;
}

.nick-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(150, 110, 70, 0.1);
    border: 1px solid rgba(150, 110, 70, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.nick-icon svg {
    width: 24px;
    height: 24px;
    color: rgba(210, 170, 120, 0.7);
}

.nick-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.nick-sub {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 20px;
    line-height: 1.5;
}

.nick-sub .room-highlight {
    color: rgba(210, 170, 120, 0.8);
}

.nick-input-wrap {
    position: relative;
    margin-bottom: 8px;
}

.nick-input {
    width: 100%;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0 50px 0 16px;
    font-size: 14px;
    font-family: inherit;
    color: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.nick-input:focus {
    border-color: rgba(150, 110, 70, 0.4);
}

.nick-input::placeholder {
    color: rgba(255, 255, 255, 0.15);
}

.nick-counter {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.15);
}

.nick-counter.warn {
    color: rgba(255, 100, 100, 0.6);
}

.nick-error {
    font-size: 11px;
    color: rgba(255, 100, 100, 0.7);
    min-height: 16px;
    margin-bottom: 12px;
    text-align: left;
    padding: 0 4px;
}

.nick-buttons {
    display: flex;
    gap: 10px;
}

.nick-btn {
    flex: 1;
    height: 44px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.nick-btn:active {
    opacity: 0.8;
}

.nick-btn-cancel {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.nick-btn-confirm {
    background: linear-gradient(
        135deg,
        rgba(150, 110, 70, 0.4) 0%,
        rgba(120, 85, 55, 0.4) 100%
    );
    color: rgba(230, 200, 160, 0.9);
    border: 1px solid rgba(150, 110, 70, 0.3);
}

.nick-btn-confirm:disabled {
    opacity: 0.3;
    cursor: default;
}

@media (min-width: 500px) {
    .nick-overlay,
    .nick-wrap {
        left: 0;
        right: 0;
        width: 100%;
    }
}

/* ─── Password Popup ─── */
.pw-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.pw-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.pw-wrap {
    position: fixed;
    inset: 0;
    z-index: 201;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    padding: 32px 24px;
}

.pw-wrap.show {
    pointer-events: auto;
}

.pw-box {
    width: 100%;
    max-width: 320px;
    background: #1e1e22;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 28px 24px 24px;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    text-align: center;
}

.pw-wrap.show .pw-box {
    transform: scale(1);
    opacity: 1;
}

.pw-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(150, 110, 70, 0.1);
    border: 1px solid rgba(150, 110, 70, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.pw-icon svg {
    width: 24px;
    height: 24px;
    color: rgba(210, 170, 120, 0.7);
}

.pw-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.pw-sub {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 24px;
    line-height: 1.5;
}

.pw-room-name {
    color: rgba(210, 170, 120, 0.8);
}

.pw-dots {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 28px;
}

.pw-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    transition: all 0.2s;
}

.pw-dot.filled {
    background: rgba(210, 170, 120, 0.8);
    border-color: rgba(210, 170, 120, 0.8);
}

.pw-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 240px;
    margin: 0 auto;
}

.pw-key {
    height: 50px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    user-select: none;
    -webkit-user-select: none;
}

.pw-key:active {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.95);
}

.pw-key.empty {
    background: transparent;
    border-color: transparent;
    cursor: default;
    pointer-events: none;
}

.pw-key.delete {
    color: rgba(255, 255, 255, 0.35);
}

.pw-key.delete svg {
    color: rgba(255, 255, 255, 0.35);
}

.pw-key.clear-all {
    font-size: 11px;
    color: rgba(255, 107, 107, 0.5);
}

.pw-cancel {
    margin-top: 16px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    padding: 8px 16px;
}

@media (min-width: 500px) {
    .pw-overlay,
    .pw-wrap {
        left: 0;
        right: 0;
        width: 100%;
    }
}