.tool-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px 64px;
}

.tool-header {
    text-align: center;
    padding: 48px 20px 36px;
    margin-bottom: 8px;
}

.header-content {
    max-width: 820px;
    margin: 0 auto;
}

.realm-kicker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 16px;
    font-family: var(--g-font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--g-gold);
}

.realm-kicker span {
    display: block;
    width: 36px;
    height: 1px;
    background: var(--g-rule-strong);
}

.tool-header h1 {
    margin: 0 0 18px;
}

.tool-header .subtitle {
    max-width: 680px;
    margin: 0 auto 22px;
    font-size: 1.05rem;
    line-height: 1.7;
}

.tool-header .subtitle strong {
    font-weight: 600;
    color: var(--g-ink);
}

.keyboard-hint {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 28px;
}

.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    max-width: 980px;
    margin: 0 auto 32px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 12px;
    border-right: 1px solid var(--g-rule);
}

.stat-item:last-child {
    border-right: 0;
}

.stat-value {
    font-size: 1.15rem;
}

.tool-content {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.options-sidebar {
    position: sticky;
    top: 20px;
}

.sidebar-header {
    padding: 16px 20px;
}

.sidebar-header h2 {
    margin: 0;
}

.option-card {
    padding: 18px 20px;
    border-bottom: 1px solid var(--g-rule);
}

.option-card:last-child {
    border-bottom: 0;
}

.option-card h3 {
    margin: 0 0 14px;
}

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

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

.control-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
    font-size: 0.86rem;
}

input[type="range"] {
    width: 100%;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    transition: border-color 140ms ease, background-color 140ms ease;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    transition: transform 140ms ease, background-color 140ms ease;
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(16px);
}

.option-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.option-item:last-child {
    margin-bottom: 0;
}

.option-label {
    flex: 1;
    font-size: 0.88rem;
    color: var(--g-ink-2);
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    cursor: pointer;
}

.action-btn:last-child {
    margin-bottom: 0;
}

.action-btn.full-width {
    width: 100%;
}

.canvas-area {
    width: 100%;
    max-width: none;
    min-width: 0;
    padding: 0;
}

.canvas-container {
    width: 100%;
    padding: 0;
    overflow: hidden;
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin: 0;
    padding: 14px 20px;
}

.canvas-hint {
    font-family: var(--g-font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--g-ink-3);
}

.world-frame {
    position: relative;
    line-height: 0;
}

body.tool-page .world-frame canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    border: 0;
    cursor: crosshair;
}

.world-legend {
    position: absolute;
    left: 14px;
    bottom: 14px;
    display: flex;
    gap: 18px;
    padding: 8px 12px;
    font-family: var(--g-font-mono);
    font-size: 0.66rem;
    line-height: 1.2;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--g-ink-2);
    background: var(--g-panel);
    border: 1px solid var(--g-rule);
}

.world-legend span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.world-legend i {
    display: block;
    width: 18px;
    height: 2px;
}

.trail-food {
    background: var(--g-gold);
}

.trail-home {
    background: var(--g-moon);
}

.help-box {
    margin-top: 40px;
    padding: 22px 26px;
}

.help-box>strong {
    display: block;
    margin-bottom: 12px;
    font-family: var(--g-font-display);
    font-size: 1.25rem;
    font-weight: 600;
    font-variant: small-caps;
    letter-spacing: 0.06em;
    text-transform: lowercase;
    color: var(--g-ink);
}

.help-box ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.help-box li {
    position: relative;
    padding: 5px 0 5px 18px;
    line-height: 1.6;
    color: var(--g-ink-2);
}

.help-box li::before {
    position: absolute;
    left: 0;
    top: 5px;
}

.help-box li strong {
    display: inline;
    margin: 0;
    font-family: var(--g-font-sans);
    font-size: inherit;
    font-weight: 600;
    font-variant: normal;
    letter-spacing: 0;
    text-transform: none;
    color: var(--g-ink);
}

@media (max-width: 1024px) {
    .tool-content {
        grid-template-columns: 1fr;
    }

    .options-sidebar {
        position: static;
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .sidebar-header {
        grid-column: 1 / -1;
    }

    .option-card {
        border-bottom: 0;
        border-right: 1px solid var(--g-rule);
    }

    .option-card:last-child {
        border-right: 0;
    }
}

@media (max-width: 700px) {
    .tool-main {
        padding: 0 16px 48px;
    }

    .tool-header {
        padding: 32px 0 28px;
    }

    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-item:nth-child(2) {
        border-right: 0;
    }

    .stat-item:nth-child(-n+2) {
        border-bottom: 1px solid var(--g-rule);
    }

    .options-sidebar {
        display: block;
    }

    .option-card {
        border-right: 0;
        border-bottom: 1px solid var(--g-rule);
    }

    .canvas-hint,
    .world-legend {
        display: none;
    }
}