/*  Reset & base  */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: black;
    font-family: sans-serif;
}

/*  Landing page  */
body.landing {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
    color: #eee;
}

#landing {
    text-align: center;
    max-width: 460px;
    padding: 40px 20px;
}

#landing h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px;
    letter-spacing: 0.5px;
}

#landing p {
    color: #888;
    margin: 0 0 36px;
    font-size: 15px;
}

.landing-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.landing-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 28px 32px;
    border-radius: 8px;
    text-decoration: none;
    color: #eee;
    border: 1px solid #333;
    background: #1a1a1a;
    transition: background 0.15s, border-color 0.15s;
    min-width: 160px;
}

.landing-btn:hover {
    background: #252525;
    border-color: #555;
}

.landing-btn--dm:hover  { border-color: #b44; }
.landing-btn--player:hover { border-color: #4a4; }

.landing-btn__title {
    font-size: 16px;
    font-weight: 600;
}

.landing-btn__desc {
    font-size: 12px;
    color: #777;
}

/*  Viewport & map layout  */
#viewport {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#clip-container {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#map-container {
    position: relative;
    width: calc(100vh * (28/15));
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    overflow: hidden;
}

@media (max-aspect-ratio: 28/15) {
    #map-container {
        width: 100vw;
        height: calc(100vw * (15/28));
    }
}

#map-image {
    position: absolute;
    top: 0;
    left: 0;
}

/*  Fog canvas  */
#fog-canvas {
    position: absolute;
    z-index: 10;
}

body.role-dm #fog-canvas {
    top: 0;
    left: 0;
    cursor: crosshair;
    touch-action: none; /* let pointer events paint instead of scrolling */
}

body.role-player #fog-canvas {
    pointer-events: none;
    filter: blur(6px);
}

/*  Flyout toggle button  */
#flyout-toggle {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 300;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    color: #ccc;
    border: 1px solid #444;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

#flyout-toggle:hover {
    background: rgba(40, 40, 40, 0.9);
    color: #fff;
}

/*  Flyout panel  */
#flyout {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    z-index: 200;
    background: rgba(15, 15, 15, 0.95);
    border-right: 1px solid #333;
    color: #ddd;
    overflow-y: auto;
    transform: translateX(0);
    transition: transform 0.2s ease;
}

#flyout.flyout-closed {
    transform: translateX(-100%);
}

#flyout-inner {
    padding: 60px 16px 20px;
    font-size: 13px;
}

/*  Flyout backdrop  */
#flyout-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 150;
    background: rgba(0, 0, 0, 0.4);
    opacity: 1;
    transition: opacity 0.2s ease;
}

#flyout-backdrop.flyout-closed {
    opacity: 0;
    pointer-events: none;
}

/*  Flyout header  */
.flyout-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.flyout-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: bold;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.flyout-badge--dm {
    background: rgba(180, 60, 60, 0.85);
    color: #fff;
}

.flyout-title {
    font-size: 16px;
    font-weight: 600;
}

/*  Flyout sections  */
.flyout-section {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #333;
}

/*  Bottom navigation bar  */
#nav-bar {
    position: fixed;
    bottom: 10px;
    left: 10px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.7);
    padding: 0;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#nav-bar.hidden {
    display: none;
}

#hotkeys {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 5px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-wrap: wrap;
}

.hk {
    font-size: 11px;
    color: #777;
    white-space: nowrap;
}

.hk kbd {
    display: inline-block;
    background: rgba(255,255,255,0.1);
    color: #aaa;
    border-radius: 2px;
    padding: 1px 4px;
    font-family: monospace;
    margin-left: 4px;
}

.hk-sep {
    width: 1px;
    height: 12px;
    background: rgba(255,255,255,0.12);
    margin: 0 4px;
}

#nav-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
}

#nav-buttons #coordinates {
    font-family: monospace;
    font-size: 13px;
    color: #aaa;
    margin-left: 8px;
}

#player-indicator {
    font-family: monospace;
    font-size: 12px;
    margin-left: 10px;
    padding: 2px 8px;
    border: 1px solid #e8c840;
    border-radius: 3px;
    color: #e8c840;
}

/*  Buttons  */
button {
    background: #555;
    color: white;
    border: none;
    padding: 5px 10px;
    margin: 2px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

button:hover {
    background: #777;
}

button.active {
    background: #b83;
    color: #fff;
}

button.btn-sm {
    height: 24px;
    margin: 0;
    padding: 0 8px;
}

/*  Control layout helpers  */
.control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 6px;
}

.row-label {
    min-width: 55px;
    color: #aaa;
}

.info-text {
    margin-top: 5px;
    font-size: 12px;
    color: #888;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.field input {
    width: 70px;
    height: 24px;
    padding: 0 3px;
}

.field label {
    font-size: 12px;
}

/*  Settings grid (two-column field pairs)  */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.settings-grid .field input {
    width: 100%;
    box-sizing: border-box;
}

.btn-full {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 6px 0;
    font-size: 12px;
    text-align: center;
    background: #333;
    border: 1px solid #444;
    border-radius: 4px;
}

.btn-full:hover {
    background: #444;
    border-color: #666;
}

/*  Form inputs in flyout  */
#flyout input[type="number"],
#flyout input[type="text"],
#flyout select {
    background: #2a2a2a;
    color: #ddd;
    border: 1px solid #444;
    border-radius: 3px;
    font-size: 12px;
}

#flyout select {
    height: 26px;
    padding: 0 4px;
    cursor: pointer;
}

/*  Player tabs  */
.player-tab {
    padding: 4px 12px;
    font-weight: bold;
    font-size: 12px;
    border: none;
    border-bottom: 2px solid transparent;
    background: #333;
    color: #aaa;
    cursor: pointer;
    transition: background 0.1s;
}

.player-tab:hover {
    background: #444;
}

.player-tab.active {
    background: #444;
    color: #fff;
}

/*  Tool grid (equal-width buttons)  */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-top: 8px;
}

.tool-grid .tool-btn {
    margin: 0;
    padding: 7px 0;
    font-size: 12px;
    text-align: center;
    background: #333;
    border: 1px solid #444;
    border-radius: 4px;
    transition: background 0.1s, border-color 0.1s;
}

.tool-grid .tool-btn:hover {
    background: #444;
    border-color: #666;
}

.tool-grid .tool-btn.active {
    background: #664a20;
    border-color: #b83;
    color: #fff;
}

/*  Brush grid  */
.brush-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 4px;
}

.brush-grid .brush-btn {
    margin: 0;
    padding: 5px 0;
    font-size: 11px;
    text-align: center;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 3px;
    color: #999;
}

.brush-grid .brush-btn:hover {
    background: #383838;
    color: #ccc;
}

.brush-grid .brush-btn.active {
    background: #3a3520;
    border-color: #886;
    color: #ddd;
}

/*  Action grid  */
.action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    margin-top: 4px;
}

.action-grid .btn-action,
.action-grid button {
    margin: 0;
    padding: 5px 0;
    font-size: 11px;
    text-align: center;
    background: #252525;
    border: 1px solid #363636;
    border-radius: 3px;
    color: #999;
}

.action-grid .btn-action:hover,
.action-grid button:hover {
    background: #353535;
    color: #ccc;
}

/*  Tool section sub-headings  */
.tool-sub {
    font-size: 11px;
    color: #666;
    margin-top: 10px;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


