﻿:root {
    --bg: #0f1216;
    --panel: #151a21;
    --panel2: #10151b;
    --text: #e7edf6;
    --muted: #a7b2c3;
    --border: rgba(255,255,255,0.08);
    --tileStroke: rgba(255,255,255,0.14);
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Noto Sans", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

.app {
    display: grid;
    grid-template-columns: 1fr 460px;
    height: 100vh;
}

.left {
    position: relative;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    min-width: 0;
    min-height: 0;
}

.canvasWrap {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.competitionHeaderArea {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    padding: 14px 14px 0 14px;
    pointer-events: none;
    z-index: 5;
}

.competitionHeaderBox {
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.85);
    border-radius: 14px;
    padding: 12px 14px;
    text-align: left;
    color: #fff;
}

.competitionHeaderBox h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.2px;
}

.competitionHeaderBox h2 {
    margin: 6px 0 0 0;
    font-size: 13px;
    font-weight: 800;
    opacity: 0.95;
}

svg {
    width: 100%;
    height: 100%;
    display: block;
    user-select: none;
    touch-action: none;
}

img {
    max-width: 100%;
    max-height: 100%;
}

label {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

input[type="number"], input[type="text"], input[type="date"], select {
    background: var(--panel2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 13px;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(0.9);
    opacity: 0.85;
    cursor: pointer;
}

input[type=range] {
    width: 150px;
    margin-top: 5px;
}

textarea {
    width: 100%;
    min-height: 140px;
    resize: vertical;
    background: var(--panel2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    font-size: 12px;
    line-height: 1.35;
    outline: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    box-sizing: border-box;
}

button {
    background: rgba(255,255,255,0.02);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 13px;
    cursor: pointer;
}
button:hover {
    border-color: rgba(255,255,255,0.18);
}
button.primary {
    background: rgba(77,163,255,0.14);
    border-color: rgba(77,163,255,0.35);
}
button.active {
    outline: 2px solid rgba(77,163,255,0.35);
    outline-offset: 0;
}

.hint {
    position: absolute;
    left: 12px;
    bottom: 12px;
    font-size: 12px;
    color: var(--muted);
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    backdrop-filter: blur(8px);
    user-select: none;
    line-height: 1.35;
    z-index: 6;
}

.right {
    display: flex;
    flex-direction: column;
    background: var(--panel);
    min-width: 0;
    min-height: 0;
}

.toolBar {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    flex: 0 0 auto;
}

.toolRow {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: end;
}

.modeButtons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.tabs {
    display: flex;
    gap: 8px;
    padding: 10px 12px 0 12px;
    flex: 0 0 auto;
    flex-wrap: wrap;
}

.tabBtn {
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
    color: var(--muted);
    font-size: 15px;
    cursor: pointer;
}

.tabBtn.active {
    border-color: rgba(77,163,255,0.35);
    color: var(--text);
    background: rgba(77,163,255,0.12);
}

.panelBody {
    padding: 12px;
    overflow: auto;
    min-height: 0;
    flex: 1 1 auto;
    overscroll-behaviour: contain;
}

.section {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.02);
}

.sectionHeaderRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.section h3 {
    margin: 0;
    font-size: 13px;
    color: var(--text);
}

.eventsTable {
    width: 100%;
    border-collapse: collapse;
}
.eventsTable th {
    font-size: smaller;
    padding: 4px;
    text-align: left;
}
.eventsTable td {
    font-size: small;
    padding: 4px;
    white-space: nowrap;
}

tr.clanEventRow {
    cursor: pointer;
}
tr.clanEventRow:hover {
    background: rgba(255,255,255,0.06);
}

.chev {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 12px;
    flex: 0 0 auto;
}

.sectionBody {
    margin-top: 10px;
}
.sectionBody.collapsed {
    display: none;
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}
.row.single {
    grid-template-columns: 1fr;
}

.toolButtons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.kv {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px;
    font-size: 12px;
    margin: 6px 0;
    color: var(--muted);
}
.kv b {
    color: var(--text);
    font-weight: 600;
    white-space: nowrap;
}

.pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}
.pill.ok {
    border-color: rgba(55,214,122,0.35);
    color: rgba(55,214,122,0.95);
}
.pill.bad {
    border-color: rgba(255,92,92,0.35);
    color: rgba(255,92,92,0.95);
}

.codeBox {
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.35;
    white-space: pre;
    overflow: auto;
    max-height: 520px;
}

.tileImage {
    border-radius: 12px;
    float: right;
    height: 90px;
    padding: 6px;
    width: 90px;
}

.small {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.35;
}

.footer {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
    background: rgba(0,0,0,0.15);
    flex: 0 0 auto;
    white-space: pre-line;
}

.colour-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.colour-input-row input[type="text"] {
    width: 100px;
}

.colour-input-row input[type="color"] {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #666;
    background: none;
    cursor: pointer;
}

.slidecontainer {
    width: 100%;
}

.slidecontainer label {
    margin-bottom: 12px;
}

.tileImage img {
    border-radius: 3px;
    display: block;
    height: auto;
    width: 100%;
}

.tileImage.dropTarget {
    cursor: pointer;
    position: relative;
    border: 2px dashed #555;
    border-radius: 6px;
    padding: 6px;
    background: rgba(255,255,255,0.02);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.tileImage.dropTarget:focus {
    outline: 2px solid #4da3ff;
    outline-offset: 2px;
}

.tileImage.dropTarget.dragover {
    border-color: #4da3ff;
    background: rgba(77,163,255,0.08);
}

.tileImage.hasImage .dropHint {
    display: none;
}

.tileImage .dropHint {
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: 11px;
    opacity: 0.6;
    pointer-events: none;
}

.dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.65);
}

.dialog-window {
    width: min(520px, calc(100vw - 32px));
    background: #171b22;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    color: #f5f5f5;
}

.dialog-header,
.dialog-body,
.dialog-actions {
    padding: 16px;
}

.dialog-header {
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    gap: 10px;
}

.dialog-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.dialog-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.dialog-body p {
    margin: 0;
}

.dialog-detail {
    margin-top: 12px;
    max-height: min(40vh, 300px);
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.85rem;
    opacity: 0.9;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

#btnConnectClan.ready {
    font-weight: 600;
}

#clanCode {
    font-family: Consolas, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

#clanCode.error {
    outline: 2px solid rgba(220, 50, 50, 0.6);
}

#clanCode.ready {
    outline: 2px solid rgba(90, 200, 90, 0.45);
    outline-offset: 2px;
}

#saveEvent:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#saveEvent.is-dirty {
    color: #4caf50; 
}

