:root {
    --panel-bg: rgba(255, 255, 255, 0.26);
    --panel-border: rgba(255, 255, 255, 0.48);
    --text-main: #1f2937;
    --accent-shadow: rgba(37, 99, 235, 0.18);
    --shadow: 0 20px 48px rgba(15, 23, 42, 0.16);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    padding: 24px;
    padding-top: 112px;
    background: url("https://rustfs.sctserver.top:448/pearl-config-web/background-image.png") center/cover fixed no-repeat;
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.12);
    pointer-events: none;
    z-index: -1;
}

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.32);
    backdrop-filter: blur(18px) saturate(170%);
    -webkit-backdrop-filter: blur(18px) saturate(170%);
    box-shadow: var(--shadow);
    z-index: 30;
}

.brand {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: 0.02em;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.nav-link {
    padding: 9px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.36);
    background: rgba(255, 255, 255, 0.18);
    color: var(--text-main);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.nav-link:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.32);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.12);
}

.nav-link.is-active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.92), rgba(37, 99, 235, 0.84));
    color: #fff;
    border-color: rgba(191, 219, 254, 0.84);
    box-shadow: 0 14px 28px var(--accent-shadow);
}

.container {
    width: 100%;
    min-height: calc(100vh - 112px);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 18px;
}

.page-title {
    text-align: center;
    color: var(--text-main);
    width: min(1152px, 100%);
    padding: 24px 28px;
    border-radius: 18px;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.24);
    backdrop-filter: blur(14px) saturate(165%);
    -webkit-backdrop-filter: blur(14px) saturate(165%);
    box-shadow: var(--shadow);
    text-shadow: 0 2px 4px rgba(255,255,255,0.8);
}

.config_box {
    position: relative;
    width: min(1152px, 100%);
    aspect-ratio: 1152 / 728;
    min-height: 560px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.16));
    backdrop-filter: blur(18px) saturate(165%);
    -webkit-backdrop-filter: blur(18px) saturate(165%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.config_box::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0.06));
    pointer-events: none;
}

.config_box::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: 17px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    pointer-events: none;
}

.crosshair {
    position: absolute;
    background: repeating-linear-gradient(
        to right,
        #2f2f2f 0,
        #2f2f2f 2px,
        transparent 2px,
        transparent 5px
    );
    opacity: 0.9;
    z-index: 1;
}

.crosshair.vertical {
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    transform: translateX(-50%);
}

.crosshair.horizontal {
    left: 0;
    right: 0;
    top: 50%;
    height: 3px;
    transform: translateY(-50%);
}

.pearl {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 56px;
    height: 56px;
    transform: translate(-50%, -50%);
    object-fit: contain;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.28));
    z-index: 3;
}

.tnt {
    position: absolute;
    width: 160px;
    height: 160px;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.16));
    z-index: 2;
}

.tnt.nw {
    left: 31%;
    top: 16%;
    transform: translate(-50%, -50%);
}

.tnt.ne {
    left: 69%;
    top: 16%;
    transform: translate(-50%, -50%);
}

.tnt.sw {
    left: 31%;
    top: 84%;
    transform: translate(-50%, -50%);
}

.tnt.se {
    left: 69%;
    top: 84%;
    transform: translate(-50%, -50%);
}

.array-option {
    position: absolute;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    color: #1f2937;
    font-size: 13px;
    font-weight: 600;
    z-index: 4;
    user-select: none;
    transform: translateX(-50%);
}

.array-option input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #dc2626;
    cursor: pointer;
}

.array-option label {
    cursor: pointer;
    white-space: nowrap;
}

.array-option.is-selected {
    background: rgba(220, 38, 38, 0.86);
    border-color: rgba(254, 202, 202, 0.72);
    box-shadow: 0 10px 24px rgba(220, 38, 38, 0.28);
    color: #fff;
}

.array-option.is-selected input[type="radio"] {
    accent-color: #fff;
}

.array-option.nw {
    left: 31%;
    top: 5%;
}

.array-option.ne {
    left: 69%;
    top: 5%;
}

.array-option.sw {
    left: 31%;
    bottom: 5%;
}

.array-option.se {
    left: 69%;
    bottom: 5%;
}

.north-indicator {
    position: absolute;
    left: 18%;
    top: 22%;
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translate(-50%, -50%);
    z-index: 3;
}

.north-letter {
    font-size: 78px;
    line-height: 1;
    font-weight: 800;
    color: #000;
    transform: translateY(14px);
}

.north-arrow {
    position: relative;
    width: 34px;
    height: 148px;
}

.north-arrow::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 6px;
    height: 118px;
    background: #000;
    transform: translateX(-50%);
    border-radius: 999px;
}

.north-arrow::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    width: 42px;
    height: 42px;
    border-top: 6px solid #000;
    border-right: 6px solid #000;
    transform: translateX(-50%) rotate(-45deg);
    transform-origin: center;
}

.drawer {
    position: absolute;
    width: 188px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    overflow: hidden;
    z-index: 4;
    transition: background 0.24s ease, box-shadow 0.24s ease;
}

.drawer.is-open {
    background: rgba(255, 255, 255, 0.22);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.16);
}

.drawer-toggle {
    position: relative;
    width: 100%;
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.2;
    font-weight: 700;
    color: #1f2937;
    text-align: center;
}

.drawer-toggle::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 16px;
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(31, 41, 55, 0.72);
    border-bottom: 2px solid rgba(31, 41, 55, 0.72);
    transform: rotate(45deg);
    transition: transform 0.24s ease;
}

.drawer.is-open .drawer-toggle::after {
    transform: rotate(225deg);
}

.drawer-content {
    padding: 0 12px;
    height: 0;
    opacity: 0;
    overflow: hidden;
    transition: height 0.28s ease, opacity 0.2s ease, padding 0.28s ease;
}

.drawer.is-open .drawer-content {
    opacity: 1;
    padding: 0 12px 12px;
}

.drawer-body {
    display: grid;
    gap: 8px;
}

.coord-input {
    display: grid;
    grid-template-columns: 22px 1fr;
    align-items: center;
    gap: 8px;
}

.coord-input label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(31, 41, 55, 0.78);
    letter-spacing: 0.04em;
    text-align: left;
}

.coord-input input {
    width: 100%;
    height: 34px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.58);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.72);
    color: #111827;
    font-size: 14px;
    outline: none;
    appearance: textfield;
    -moz-appearance: textfield;
}

.coord-input input:focus {
    border-color: rgba(37, 99, 235, 0.8);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.coord-input input::placeholder {
    color: #9ca3af;
}

.coord-input input::-webkit-outer-spin-button,
.coord-input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.modal-input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.58);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
    color: #111827;
    font-size: 15px;
    outline: none;
    appearance: textfield;
    -moz-appearance: textfield;
}

.modal-input:focus {
    border-color: rgba(37, 99, 235, 0.8);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.modal-input::-webkit-outer-spin-button,
.modal-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.drawer.nw {
    left: 25%;
    top: 25%;
}

.drawer.ne {
    right: 25%;
    top: 25%;
}

.drawer.sw {
    left: 25%;
    bottom: 25%;
}

.drawer.se {
    right: 25%;
    bottom: 25%;
}

.drawer.cannon {
    left: 50%;
    top: 5%;
    transform: translateX(-50%);
}

.drawer.pearl-info {
    left: 50%;
    top: calc(50% + 54px);
    transform: translateX(-50%);
}

.status-banner {
    position: absolute;
    left: 50%;
    top: 18px;
    transform: translateX(-50%);
    min-width: 280px;
    max-width: calc(100% - 32px);
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(220, 38, 38, 0.9);
    color: #fff;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(220, 38, 38, 0.24);
    z-index: 8;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.status-banner.show {
    opacity: 1;
}

.tnt-auto-wrap {
    position: absolute;
    left: 16px;
    top: 16px;
    z-index: 7;
}

.tnt-auto-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.46);
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    user-select: none;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
}

.tnt-auto-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.tnt-auto-track {
    position: relative;
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: rgba(107, 114, 128, 0.7);
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.tnt-auto-track::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.26);
    transition: transform 0.2s ease;
}

.tnt-auto-switch input:checked + .tnt-auto-track {
    background: rgba(16, 185, 129, 0.92);
}

.tnt-auto-switch input:checked + .tnt-auto-track::after {
    transform: translateX(18px);
}

.tnt-auto-text {
    font-size: 13px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
    white-space: nowrap;
}

.tnt-auto-tip {
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    width: min(340px, 62vw);
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.46);
    background: rgba(17, 24, 39, 0.86);
    color: rgba(255, 255, 255, 0.95);
    font-size: 12px;
    line-height: 1.5;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.35);
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.tnt-auto-wrap:hover .tnt-auto-tip {
    opacity: 1;
    transform: translateY(0);
}

.page-jump-btn {
    position: absolute;
    right: 132px;
    top: 24px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.88), rgba(37, 99, 235, 0.8));
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.2);
    z-index: 5;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.page-jump-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.52), rgba(37, 99, 235, 0.38));
    box-shadow: 0 18px 32px rgba(37, 99, 235, 0.28);
}

.generate-btn {
    position: absolute;
    right: 24px;
    top: 24px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 8px;
    padding: 8px 24px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.84), rgba(22, 163, 74, 0.74));
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 14px 28px rgba(22, 163, 74, 0.18);
    z-index: 5;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.generate-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.46), rgba(22, 163, 74, 0.32));
    box-shadow: 0 18px 32px rgba(22, 163, 74, 0.24);
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 20;
}

.modal.show {
    display: flex;
}

.modal-card {
    width: min(720px, 100%);
    background: rgba(255, 255, 255, 0.24);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

.modal-title {
    color: #1f2937;
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.4);
    color: #1f2937;
    font-size: 18px;
    cursor: pointer;
}

.modal-body {
    padding: 22px;
}

.modal-text {
    color: #374151;
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 14px;
}

.modal-error {
    display: none;
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(254, 215, 215, 0.95);
    color: #c53030;
    font-size: 13px;
    font-weight: 600;
}

.modal-error.show {
    display: block;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 22px 22px;
}

.modal-btn,
.copy-btn {
    border: 0;
    border-radius: 10px;
    padding: 10px 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: transform 0.2s ease, background 0.2s ease;
}

.modal-btn:hover,
.copy-btn:hover {
    transform: translateY(-1px);
}

.modal-btn.secondary {
    background: rgba(255, 255, 255, 0.46);
    color: #374151;
}

.modal-btn.primary,
.copy-btn {
    background: rgba(72, 187, 120, 0.9);
    color: #fff;
}

.copy-btn:hover,
.modal-btn.primary:hover {
    background: rgba(66, 153, 225, 0.9);
}

.copy-btn.copied {
    background: rgba(72, 187, 120, 0.9);
}

.output-container {
    position: relative;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.output-header {
    background: rgba(255, 255, 255, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.output-label {
    color: #2d3748;
    font-size: 0.9em;
    font-family: monospace;
    font-weight: 600;
}

pre {
    margin: 0;
    padding: 20px;
    color: #2d3748;
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: rgba(255, 255, 255, 0.15);
    max-height: 60vh;
    min-height: 260px;
    overflow-y: auto;
}

.json-key {
    color: #2b6cb0;
    font-weight: 600;
}

.json-string {
    color: #c05621;
}

.json-number {
    color: #276749;
}

@media (max-width: 900px) {
    body {
        padding: 12px;
        padding-top: 108px;
    }

    .topbar {
        padding: 12px;
        align-items: flex-start;
        flex-direction: column;
    }

    .nav-links {
        width: 100%;
        justify-content: flex-start;
    }

    .container {
        min-height: calc(100vh - 108px);
    }

    .page-title {
        font-size: 24px;
        text-align: center;
    }

    .config_box {
        min-height: 0;
    }

    .tnt {
        width: 92px;
        height: 92px;
    }

    .drawer {
        width: 156px;
    }

    .drawer-toggle {
        padding: 10px 12px;
        font-size: 12px;
    }

    .drawer-toggle::after {
        right: 10px;
        top: 14px;
    }

    .drawer.is-open .drawer-content {
        padding: 0 10px 10px;
    }

    .drawer-body {
        gap: 6px;
    }

    .coord-input {
        grid-template-columns: 18px 1fr;
        gap: 6px;
    }

    .coord-input input {
        height: 30px;
        font-size: 13px;
        padding: 0 8px;
    }

    .drawer.nw {
        left: 8%;
        top: 10%;
    }

    .drawer.ne {
        right: 8%;
        top: 10%;
    }

    .drawer.sw {
        left: 8%;
        bottom: 10%;
    }

    .drawer.se {
        right: 8%;
        bottom: 10%;
    }

    .drawer.cannon {
        top: 4%;
    }

    .drawer.pearl-info {
        top: calc(50% + 42px);
    }

    .tnt-auto-wrap {
        left: 8px;
        top: 8px;
    }

    .tnt-auto-switch {
        padding: 6px 8px;
        gap: 8px;
    }

    .tnt-auto-track {
        width: 34px;
        height: 20px;
    }

    .tnt-auto-track::after {
        width: 14px;
        height: 14px;
    }

    .tnt-auto-switch input:checked + .tnt-auto-track::after {
        transform: translateX(14px);
    }

    .tnt-auto-text {
        font-size: 12px;
    }

    .tnt-auto-tip {
        width: min(280px, 72vw);
        font-size: 11px;
        padding: 8px 10px;
    }

    .page-jump-btn {
        right: 98px;
        top: 8px;
        padding: 6px 10px;
        font-size: 12px;
    }

    .array-option {
        padding: 6px 10px;
        gap: 6px;
        font-size: 12px;
    }

    .array-option.nw,
    .array-option.ne {
        top: 2%;
    }

    .array-option.sw,
    .array-option.se {
        bottom: 2%;
    }

    .pearl {
        width: 44px;
        height: 44px;
    }

    .north-letter {
        font-size: 58px;
    }

    .north-arrow {
        width: 24px;
        height: 112px;
    }

    .north-arrow::before {
        width: 4px;
        height: 88px;
    }

    .north-arrow::after {
        width: 30px;
        height: 30px;
        border-top-width: 4px;
        border-right-width: 4px;
    }
}