/* VTT Channel Styles */

.vtt-root {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #1a1a2e;
    position: relative;
}

/* ── Canvas area ── */
.vtt-canvas-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

#vttCanvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.vtt-dice-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* ── Toolbar ── */
.vtt-toolbar {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 4px;
    background: #2b2d31cc;
    backdrop-filter: blur(6px);
    border-radius: 8px;
    padding: 6px;
    z-index: 20;
}

.vtt-tool-btn {
    background: #3b3e44;
    border: none;
    border-radius: 6px;
    color: #dbdee1;
    cursor: pointer;
    font-size: 18px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.vtt-tool-btn:hover { background: #5865f2; }

.vtt-tool-sep {
    width: 1px;
    background: #4e5058;
    margin: 4px 2px;
}
.vtt-grid-size-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 2px;
}
.vtt-grid-label {
    color: #b5bac1;
    font-size: 16px;
    line-height: 1;
}
.vtt-grid-input {
    width: 52px !important;
    height: 28px;
    padding: 2px 4px;
    font-size: 13px;
    text-align: center;
}

.vtt-fog-tools {
    position: absolute;
    top: 56px;
    left: 10px;
    display: flex;
    gap: 6px;
    background: #2b2d31ee;
    border-radius: 8px;
    padding: 6px;
    z-index: 20;
}

/* ── Sidebar ── */
.vtt-sidebar {
    width: 240px;
    min-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #2b2d31;
    border-left: 1px solid #1e1f22;
    overflow-y: auto;
}

.vtt-voice-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #232428;
    border-bottom: 1px solid #1e1f22;
    font-size: 12px;
    color: #57f287;
    flex-shrink: 0;
}

.vtt-panel {
    border-bottom: 1px solid #1e1f22;
    flex-shrink: 0;
}

.vtt-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #b5bac1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #232428;
    gap: 6px;
}

/* ── Combat tracker ── */
.vtt-combatant-list {
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 240px;
    overflow-y: auto;
}

.vtt-combatant {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 6px;
    background: #313338;
    font-size: 13px;
    color: #dbdee1;
}

.vtt-combatant.vtt-active-turn {
    background: #5865f2;
    color: #fff;
}

.vtt-init-badge {
    background: #1e1f22;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 11px;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
}

.vtt-active-turn .vtt-init-badge { background: #4752c4; }

.vtt-combatant-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.vtt-hp-pill {
    font-size: 11px;
    color: #57f287;
    background: #1e1f22;
    padding: 1px 5px;
    border-radius: 4px;
}

/* ── Roll log ── */
.vtt-roll-log {
    flex: 1;
    min-height: 120px;
    display: flex;
    flex-direction: column;
}

.vtt-roll-log .vtt-panel-header { flex-shrink: 0; }

#vttRollLogList {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.vtt-roll-entry {
    font-size: 12px;
    color: #b5bac1;
    padding: 4px 6px;
    background: #313338;
    border-radius: 4px;
}

.vtt-roll-name {
    color: #dbdee1;
    font-weight: 600;
    margin-right: 4px;
}

/* ── Character sheet panel ── */
.vtt-sheet-panel {
    position: absolute;
    right: 244px;
    top: 10px;
    width: 640px;
    max-height: calc(100% - 20px);
    overflow-y: auto;
    overflow-x: hidden;
    background: #2b2d31;
    border: 1px solid #1e1f22;
    border-radius: 8px;
    z-index: 30;
    display: flex;
    flex-direction: column;
}

.vtt-sheet-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid #1e1f22;
    background: #2b2d31;
    flex-shrink: 0;
    z-index: 1;
}

.vtt-sheet-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Field groups */
.vtt-sheet-field-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.vtt-sheet-label {
    font-size: 10px;
    font-weight: 700;
    color: #80848e;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.vtt-sheet-full { width: 100%; box-sizing: border-box; }
.vtt-sheet-textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 52px; }

/* Multi-column grids */
.vtt-sheet-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.vtt-sheet-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

/* Combat stat boxes (value on top, label below) */
.vtt-sheet-combat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.vtt-sheet-combat-box .vtt-input {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}
.vtt-sheet-combat-box .vtt-sheet-label { text-align: center; }

/* Inspiration checkbox in combat box */
.vtt-inspiration-check { width: 20px; height: 20px; cursor: pointer; margin-top: 4px; }

/* Death saves */
.vtt-sheet-death-saves {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.vtt-sheet-death-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #b5bac1;
}
.vtt-sheet-death-row span { width: 72px; flex-shrink: 0; }
.vtt-sheet-death-row input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }

/* Ability scores — editable version */
.vtt-abilities {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin: 2px 0;
}

.vtt-ability {
    background: #313338;
    border-radius: 6px;
    padding: 6px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.vtt-ability-name { font-size: 10px; color: #b5bac1; text-transform: uppercase; letter-spacing: 0.05em; }
.vtt-ability-mod  { font-size: 15px; color: #5865f2; font-weight: 700; line-height: 1; }
.vtt-ability-score-input {
    width: 44px;
    text-align: center;
    background: #1e1f22;
    border: 1px solid #3b3e44;
    border-radius: 4px;
    color: #f2f3f5;
    font-size: 16px;
    font-weight: 700;
    padding: 2px 0;
    outline: none;
}
.vtt-ability-score-input:focus { border-color: #5865f2; }

/* Saving throws / skills list */
.vtt-save-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.vtt-save-row {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #b5bac1;
    padding: 2px 2px;
}
.vtt-prof-check { width: 13px; height: 13px; flex-shrink: 0; cursor: pointer; }
.vtt-save-row-name { flex: 1; color: #dbdee1; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vtt-skill-ab { color: #80848e; font-size: 10px; }

/* PF2e proficiency rank select */
.vtt-rank-select {
    background: #1e1f22;
    border: 1px solid #3b3e44;
    border-radius: 3px;
    color: #5865f2;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 2px;
    outline: none;
    cursor: pointer;
    flex-shrink: 0;
}
.vtt-rank-select:focus { border-color: #5865f2; }

/* Passive perception */
.vtt-sheet-passive { font-size: 12px; color: #b5bac1; margin-bottom: 2px; }

/* Section headers */
.vtt-sheet-section {
    font-size: 11px;
    font-weight: 700;
    color: #b5bac1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 3px;
    border-bottom: 1px solid #3b3e44;
    margin-top: 6px;
}
.vtt-sheet-section-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Attack rows */
.vtt-attack-row {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 2px 0;
}
.vtt-atk-name { flex: 1; min-width: 0; }
.vtt-atk-stat { width: 52px; text-align: center; }

/* Currency */
.vtt-sheet-currency {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    margin-bottom: 4px;
}
.vtt-sheet-currency .vtt-sheet-combat-box .vtt-input {
    padding: 2px 0;
    font-size: 12px;
}

/* Stat pill (kept for pf2e / generic) */
.vtt-stat-pill {
    background: #313338;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12px;
    color: #dbdee1;
}
.vtt-sheet-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #b5bac1;
}
.vtt-sheet-name { font-size: 18px; font-weight: 700; color: #f2f3f5; }
.vtt-sheet-meta { font-size: 12px; color: #b5bac1; margin-top: -4px; }

/* ── Shared inputs / buttons ── */
.vtt-input {
    background: #1e1f22;
    border: 1px solid #3b3e44;
    border-radius: 4px;
    color: #dbdee1;
    font-size: 13px;
    padding: 4px 8px;
    outline: none;
}
.vtt-input:focus { border-color: #5865f2; }

.vtt-btn-sm {
    background: #4e5058;
    border: none;
    border-radius: 4px;
    color: #dbdee1;
    cursor: pointer;
    font-size: 11px;
    padding: 3px 8px;
    white-space: nowrap;
}
.vtt-btn-sm:hover { background: #5865f2; color: #fff; }
.vtt-btn-danger { background: #ed4245; }
.vtt-btn-danger:hover { background: #c03537; }

.vtt-roll-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px;
    opacity: 0.7;
    line-height: 1;
}
.vtt-roll-btn:hover { opacity: 1; }

.vtt-empty {
    color: #6d6f78;
    font-size: 12px;
    text-align: center;
    padding: 8px;
}

/* ── Dice Builder ── */
.vtt-dice-builder-panel { flex-shrink: 0; }

.vtt-die-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 6px 6px 4px;
}
.vtt-die-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.vtt-die-icon {
    width: 28px;
    height: 28px;
    color: #b5bac1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.vtt-die-icon svg { width: 100%; height: 100%; }
.vtt-die-label {
    font-size: 10px;
    color: #80848e;
    font-weight: 600;
    line-height: 1;
}
.vtt-die-controls {
    display: flex;
    align-items: center;
    gap: 2px;
}
.vtt-die-btn {
    background: #3b3e44;
    border: none;
    border-radius: 3px;
    color: #dbdee1;
    cursor: pointer;
    font-size: 13px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}
.vtt-die-btn:hover { background: #5865f2; }
.vtt-die-count {
    font-size: 12px;
    color: #80848e;
    min-width: 14px;
    text-align: center;
    font-weight: 600;
}
.vtt-die-count-active { color: #5865f2; }
.vtt-die-modifier-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 6px;
    border-top: 1px solid #3f4147;
    margin-top: 2px;
}
.vtt-die-mod-label {
    font-size: 11px;
    color: #80848e;
    flex: 1;
}
.vtt-btn-primary { background: #5865f2; color: #fff; }
.vtt-btn-primary:hover { background: #4752c4; }

/* ── Mobile ── */
@media (max-width: 768px) {
    .vtt-sidebar { width: 200px; min-width: 160px; }
    .vtt-sheet-panel { right: 164px; width: calc(100vw - 174px); }
}

.vtt-ctx-menu {
    background: #2b2d31;
    border: 1px solid #3f4147;
    border-radius: 6px;
    padding: 4px;
    min-width: 160px;
    box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
.vtt-ctx-item {
    padding: 7px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #dbdee1;
    white-space: nowrap;
}
.vtt-ctx-item:hover { background: #5865f2; color: #fff; }
.vtt-ctx-danger { color: #ed4245; }
.vtt-ctx-danger:hover { background: #ed4245; color: #fff; }
