:root {
    --bg: #0b1020;
    --card: #0f172a;
    --muted: #94a3b8;
    --text: #e5e7eb;
    --accent: #38bdf8;
    --accent-2: #22c55e;
    --danger: #ef4444;
    --radius: 16px;
}

* {
    box-sizing: border-box
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #0a0f1f;
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 1px solid #11182c
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22d3ee, #3b82f6);
    display: grid;
    place-items: center;
    font-weight: 700
}

.player-name {
    font-weight: 600
}

.player-level {
    font-size: 12px;
    color: var(--muted)
}

.stats {
    display: flex;
    gap: 16px;
    min-width: 260px
}

.stat .label {
    font-size: 12px;
    color: var(--muted)
}

.bar {
    width: 100%;
    height: 8px;
    background: #0b152b;
    border-radius: 999px;
    overflow: hidden
}

.fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2))
}

.stat input[type=range] {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    background: #1e293b;
    border-radius: 999px;
    margin-top: 4px
}

.stat input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer
}

main {
    max-width: 980px;
    margin: 0 auto;
    padding: 16px
}

.tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap
}

.tab {
    background: #0d1730;
    border: 1px solid #172347;
    color: var(--text);
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer
}

.tab.active {
    outline: 2px solid var(--accent)
}

.tab.secondary {
    opacity: .85
}

.hidden {
    display: none !important
}

.realm-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    background: var(--card);
    border: 1px solid #172347;
    border-radius: var(--radius);
    padding: 16px;
    margin: 16px 0
}

.realm-level {
    color: var(--muted);
    font-size: 14px
}

.realm-progress .bar {
    height: 12px
}

.actions {
    display: flex;
    gap: 8px;
    margin: 12px 0
}

button {
    border: none;
    border-radius: 12px;
    padding: 10px 14px;
    background: var(--accent);
    color: #00111a;
    font-weight: 700;
    cursor: pointer
}

button.ghost {
    background: #0d1730;
    color: var(--text);
    border: 1px solid #172347
}

button.danger {
    background: var(--danger);
    color: white
}

.list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px
}

.list.compact .card {
    padding: 8px
}

.card {
    background: var(--card);
    border: 1px solid #172347;
    border-radius: 14px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center
}

.card .meta {
    font-size: 12px;
    color: var(--muted)
}

.row {
    display: flex;
    gap: 8px;
    align-items: center
}

.daily {
    margin: 12px 0;
    color: var(--muted);
    font-size: 14px
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px
}

label {
    display: grid;
    gap: 6px;
    font-size: 14px
}

input,
select,
textarea {
    background: #0b152b;
    color: var(--text);
    border: 1px solid #172347;
    border-radius: 10px;
    padding: 10px
}

textarea#ics-urls {
    width: 100%
}

.file {
    display: inline-grid;
    gap: 6px
}

dialog {
    border: none;
    border-radius: 16px;
    padding: 0;
    max-width: 420px;
    width: 90%
}

dialog form {
    background: var(--card);
    border: 1px solid #172347;
    border-radius: 16px;
    padding: 16px
}

menu {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin: 12px 0 0;
    padding: 0
}

.game-wrap {
    position: relative;
    margin-top: 18px;
    background: var(--card);
    border: 1px solid #172347;
    border-radius: var(--radius);
    padding: 12px
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px
}

.game-header h2 {
    margin: 0
}

.game-stats {
    display: flex;
    gap: 12px;
    align-items: center;
    color: var(--muted);
    font-size: 14px
}

#game-canvas {
    width: 100%;
    height: auto;
    display: block;
    background: linear-gradient(#0a1530, #0b1020);
    border-radius: 12px;
    border: 1px solid #172347
}

.legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px
}

.legend code {
    background: #0d1730;
    border: 1px solid #172347;
    border-radius: 6px;
    padding: 0 6px;
    color: var(--text)
}

.buffs-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px
}

.buffs-panel,
.inventory-panel {
    background: #0d1730;
    border: 1px solid #172347;
    border-radius: 10px;
    padding: 10px
}

.buffs-panel h3,
.inventory-panel h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: var(--muted)
}

.chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap
}

.chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #102040;
    border: 1px solid #1b2c55;
    font-size: 12px
}

.chip .timer {
    opacity: .8
}

.inv-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap
}

.inv-use {
    background: #22c55e;
    color: #00110c
}

.inv-drop {
    background: #ef4444;
    color: white
}

.shop-panel {
    margin-top: 12px;
    background: #0d1730;
    border: 1px solid #172347;
    border-radius: 10px;
    padding: 10px
}

.shop-panel h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: var(--muted)
}

.price {
    color: #facc15;
    font-weight: 700
}

.buy {
    background: #38bdf8;
    color: #00111a
}

.mode-schedule {
    background: #0d1730;
    border: 1px solid #172347;
    border-radius: 10px;
    padding: 10px
}

.mode-schedule h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: var(--muted)
}

.schedule-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    margin: 8px 0
}

#ms-list .card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px
}

.badge {
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #1b2c55;
    background: #102040;
    font-size: 12px
}

.debug-hud {
    position: absolute;
    right: 12px;
    top: 12px;
    z-index: 5;
    background: #0b152bcc;
    backdrop-filter: blur(2px);
    border: 1px solid #172347;
    border-radius: 10px;
    padding: 8px 10px;
    color: #e5e7eb;
    font-size: 12px;
    line-height: 1.35;
    min-width: 180px
}

.debug-hud .row {
    display: flex;
    justify-content: space-between;
    gap: 8px
}

/* Quiz Overlay Styles */
#quiz-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 10, 0.85); /* dark transparent overlay */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  color: #fff;
  font-family: 'Trebuchet MS', sans-serif;
  text-align: center;
  padding: 20px;
}

#quiz-question {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 30px;
  max-width: 800px;
}

#quiz-input,
#quiz-options button {
  font-size: 1.5rem;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  margin: 10px;
  cursor: pointer;
}

#quiz-input {
  width: 300px;
  text-align: center;
}

#quiz-options button {
  background: #4cafef;
  color: white;
  transition: background 0.2s;
}

#quiz-options button:hover {
  background: #3a91d1;
}

#quiz-progress {
  margin-top: 20px;
  font-size: 1rem;
  opacity: 0.8;
}

#life-quiz-modal h2{
    color: white;
}

#life-quiz-stage {
    color: white;
}