.panel {
    width: var(--panel-width);
    flex-shrink: 0;
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: var(--pad-panel, 20px);
    display: flex;
    flex-direction: column;
    gap: var(--gap-panel, 18px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.menu-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition-fast, 0.15s);
}

.menu-toggle:hover {
    background: var(--hover);
}

.section-point-a {
    border-left: 3px solid var(--point-a);
    background: var(--point-a-bg);
    padding-left: calc(var(--pad-section, 12px) - 3px);
}

.section-point-b {
    border-left: 3px solid var(--point-b);
    background: var(--point-b-bg);
    padding-left: calc(var(--pad-section, 12px) - 3px);
}

.section-point-a h2,
.section-point-b h2 {
    margin-bottom: 8px;
}

.section-point-a h2 {
    color: var(--point-a);
}

.section-point-b h2 {
    color: var(--point-b);
}

.coord-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    align-items: stretch;
}

.coord-row label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--muted);
    font-feature-settings: "tnum";
    background: var(--field);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 8px 2px;
    transition: border-color var(--transition-fast, 0.15s);
}

.coord-row label:focus-within {
    border-color: var(--accent);
}

input[type="number"] {
    width: 100%;
    min-height: var(--touch-min, 40px);
    background: var(--field);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--font-body, 15px);
    transition: border-color var(--transition-fast, 0.15s);
}

input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: inner-spin-button;
    opacity: 1;
    cursor: pointer;
    height: 26px;
}

input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--accent);
}

input[type="number"]:invalid {
    border-color: var(--danger);
}

.clear {
    background: none;
    border: none;
    color: var(--dim);
    font-size: 18px;
    cursor: pointer;
    padding: 8px 2px;
    line-height: 1;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear:hover {
    color: var(--danger);
}

.clear:active {
    color: var(--danger);
}

.result {
    background: linear-gradient(135deg, var(--field) 0%, rgba(159, 211, 86, 0.04) 100%);
    border: 1px solid rgba(159, 211, 86, 0.15);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: grid;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 2;
    transition: background var(--transition-fast, 0.15s);
}

.result div {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-result, 14px);
    gap: 12px;
    align-items: baseline;
    padding: 6px 0;
    border-bottom: 1px solid rgba(159, 211, 86, 0.06);
}

.result div:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.result div:first-child {
    padding-top: 0;
}

.result span {
    color: var(--muted);
    flex-shrink: 0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.result b {
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    font-weight: 700;
    text-align: right;
    word-break: break-word;
    animation: resultPulse 0.25s ease;
}

@keyframes resultPulse {
    0% {
        opacity: 0.4;
        transform: translateY(-2px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.result b.oor {
    color: var(--danger);
}

.result b.warn {
    color: var(--warn);
}

.controls-section {
    background: var(--field);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--pad-section, 12px 14px);
}

@media (max-width: 800px) {
    .controls-section {
        padding: 10px 12px;
    }
}

.controls-section h2 {
    margin-bottom: 12px;
}

.control-group {
    margin-bottom: 14px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-label {
    display: block;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 6px;
    font-weight: 600;
}

.radio-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.radio-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    padding: 12px 8px;
    background: var(--field);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.radio-option:hover {
    border-color: var(--dim);
    background: var(--hover);
}

.radio-option:has(input:checked) {
    border-color: var(--accent);
    background: rgba(159, 211, 86, 0.08);
}

.radio-option:has(input:checked) span {
    color: var(--accent);
    font-weight: 600;
}

.radio-option:active {
    transform: scale(0.97);
}

.radio-option input[type="radio"] {
    width: 0;
    height: 0;
    opacity: 0;
    position: absolute;
    cursor: pointer;
    margin: 0;
}

.radio-option input[type="radio"]:disabled {
    cursor: not-allowed;
}

.radio-option span {
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    text-align: center;
    line-height: 1.3;
}

.hint {
    font-size: 12px;
    color: var(--dim);
    line-height: 1.6;
}

.contact {
    background: var(--field);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.contact-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
}

.contact-email {
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
    font-family: monospace;
    word-break: break-all;
    transition: color .15s ease;
}

.contact-email:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.discord-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.discord-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    background: var(--field);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px;
    transition: border-color .15s ease;
}

.discord-qr:hover {
    border-color: var(--accent);
}

.discord-qr img {
    width: 200px;
    height: 200px;
    border-radius: var(--radius-sm);
    background: #fff;
    padding: 6px;
}

.discord-qr span {
    font-size: 12px;
    color: var(--muted);
}

.discord-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: var(--discord);
    color: #fff;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background .15s ease, transform .1s ease;
    box-shadow: 0 2px 8px rgba(88, 101, 242, .3);
}

.discord-btn:hover {
    background: var(--discord-hover);
}

.discord-btn:active {
    transform: translateY(1px);
}

.discord-btn svg {
    flex-shrink: 0;
}

.translate-widget {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.translate-widget select {
    width: 100%;
    min-height: var(--touch-min, 40px);
}

.translate-widget label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
}

.translate-widget select {
    background: var(--field);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
}

.translate-widget select:focus {
    outline: none;
    border-color: var(--accent);
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.draw-tool {
    height: 36px;
    border: 1px solid var(--border);
    background: var(--field);
    color: var(--text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.draw-tool:hover {
    background: var(--hover);
    border-color: var(--dim);
}

@media (hover: hover) and (pointer: fine) {
    .draw-tool {
        height: 36px;
    }
}

.draw-tool.active {
    border-color: var(--accent);
    background: rgba(159, 211, 86, 0.12);
    box-shadow: 0 0 0 1px var(--accent);
}

.width-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.width-opt {
    height: 28px;
    min-height: 28px;
    border: 1px solid var(--border);
    background: var(--field);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    transition: background var(--transition-fast, 0.15s), border-color var(--transition-fast, 0.15s);
}

.width-opt span {
    display: block;
    width: 16px;
    background: currentColor;
    border-radius: 1px;
}

.width-opt .w1 {
    height: 1px;
}

.width-opt .w2 {
    height: 2px;
}

.width-opt .w3 {
    height: 3px;
}

.width-opt .w4 {
    height: 4px;
}

.width-opt:hover {
    background: var(--hover);
}

.width-opt.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.clear-drawings-btn {
    width: 100%;
    height: var(--touch-min, 44px);
    background: var(--field);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: background var(--transition-fast, 0.15s), border-color var(--transition-fast, 0.15s);
}

@media (hover: hover) and (pointer: fine) {
    .clear-drawings-btn {
        height: 40px;
    }
}

.clear-drawings-btn:hover {
    background: var(--hover);
    border-color: var(--dim);
}

.clear-drawings-btn:active {
    background: var(--hover);
    border-color: var(--dim);
}

.lobby-section {
    background: var(--field);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-top: 8px;
}

.lobby-section h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lobby-info {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 10px;
    font-family: monospace;
}

.lobby-players {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
    max-height: 150px;
    overflow-y: auto;
}

.lobby-section .view-reset {
    width: 100%;
    text-align: center;
}

.map-select {
    width: 100%;
    margin-top: 6px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--field);
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

.map-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.controls-section {
    transition: background var(--transition-fast, 0.15s);
}

.controls-section h2 {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    user-select: none;
    -webkit-user-select: none;
}

.controls-section h2::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--dim);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.controls-section.collapsed h2::after {
    transform: rotate(-90deg);
}

.controls-section>.control-group,
.controls-section>.width-grid,
.controls-section>.hint {
    transition: opacity 0.2s ease, max-height 0.3s ease;
    overflow: hidden;
}

.controls-section.collapsed>.control-group,
.controls-section.collapsed>.tool-status {
    display: none;
}

.panel-header .header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.map-badge {
    display: inline-block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    background: rgba(159, 211, 86, 0.1);
    padding: 1px 8px;
    border-radius: 4px;
    font-weight: 600;
    width: fit-content;
    transition: background var(--transition-fast, 0.15s), color var(--transition-fast, 0.15s);
}

.draw-tool {
    transition: all 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .draw-tool:hover:not(.active) {
        transform: translateY(-1px);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    }

    .draw-tool.active {
        transform: translateY(-1px);
    }

    .draw-tool:active {
        transform: translateY(0) scale(0.95);
    }
}

.tool-status {
    font-size: 11px;
    color: var(--dim);
    text-align: center;
    min-height: 16px;
    line-height: 16px;
    margin-top: 4px;
    transition: opacity 0.15s ease;
}

.tool-status:empty {
    opacity: 0;
}