/* wheel.css - the /wheel page. Builds on /css/theme.css; the wheel itself is wheel-render.css. */

.wh-import { margin-top: var(--space-3); }

/* right: the selected wheel */
.wh-main { min-width: 0; }
.wh-empty { padding: var(--space-5); text-align: center; }
.wh-empty p { margin: 0 auto var(--space-4); max-width: 460px; }
.wh-head { display: flex; align-items: center; gap: var(--space-2); padding: 10px 12px; margin-bottom: var(--space-4); }
.wh-name { flex: 1; min-width: 0; max-width: 360px; font: 600 16px var(--font); }
.wh-head-actions { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }

.wh-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
@media (max-width: 1100px) { .wh-grid { grid-template-columns: 1fr; } .wh-stage-col { order: -1; } }
.wh-col { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.wh-col > .card { padding: var(--space-4); }
.wh-sec-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-3); }
.wh-sec-head h3 { margin: 0; }
.wh-stage-col { position: sticky; top: var(--space-4); }
@media (max-width: 1100px) { .wh-stage-col { position: static; } }

/* entries */
.wh-add { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-2); }
.wh-add .input { flex: 1; min-width: 140px; }
.wh-bulk { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); margin-bottom: var(--space-3); }
.wh-bulk textarea { width: 100%; box-sizing: border-box; resize: vertical; font: 14px var(--font); }
.wh-item { padding: 3px 0; border-top: 1px solid var(--border); }
.wh-item .input { padding: 4px 8px; font-size: 13px; }
.wh-item .icon-btn { width: 26px; height: 26px; }
.wh-pic { flex-shrink: 0; width: 28px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; cursor: pointer; }
.wh-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wh-item-more .wh-color { width: 34px; height: 26px; }
.wh-item:first-child { border-top: 0; }
.wh-item.off .wh-ename, .wh-item.off .wh-pic, .wh-item.off .wh-odds { opacity: .5; }
.wh-item-main { display: flex; align-items: center; gap: 6px; }
.wh-vis { flex-shrink: 0; }
.wh-color { flex-shrink: 0; }
.wh-ename { flex: 1; min-width: 60px; font-weight: 600; }
.wh-ename-ro { flex: 1; min-width: 0; font: 600 13px var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 5px 0; }
.wh-odds { display: flex; align-items: center; gap: 3px; color: var(--text-muted); font-size: 13px; }
.wh-item-more { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); padding: 10px 12px; background: var(--surface-sunken); border-radius: var(--radius-sm); }
.wh-item-more[hidden] { display: none; }
.wh-inline { display: flex; align-items: center; gap: 8px; font: 13px var(--font); color: var(--text-muted); }
.wh-inline > span:first-child { min-width: 52px; }
.wh-inline .input { flex: 1; min-width: 0; }
.wh-hint { margin: 4px 0 0; }
/* the Picture row: the label lines up with the field (UI.mediaField), any hint goes under the field */
.wh-media { flex: 1; min-width: 0; }
.wh-pic-row { align-items: flex-start; }
.wh-pic-row > span:first-child { line-height: 34px; }
.wh-mods-note { margin: var(--space-2) 0 0; }
.wh-mods-note a { color: var(--accent); }

/* advanced: Stream Deck (orange marks the advanced bits) */
.wh-adv { margin-top: var(--space-3); font-size: 13px; }
.wh-deck { margin-top: var(--space-2); padding: 10px 12px; border: 1px solid #ff9a3c; border-radius: var(--radius-sm); background: var(--surface-sunken); font: 13px/1.45 var(--font); color: var(--text-muted); }
.wh-deck p { margin: 0 0 var(--space-2); }
.wh-deck b { color: var(--text); }

/* settings */
.wh-settings summary h3 { display: inline; margin: 0; }
.wh-set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3) var(--space-4); margin-top: var(--space-3); }
.wh-set-grid .wh-wide, .wh-sub { grid-column: 1 / -1; }
.wh-sub { margin: var(--space-2) 0 0; padding-top: var(--space-3); border-top: 1px solid var(--border); font: 600 12px var(--font); color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.wh-sub:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.wh-range { display: flex; align-items: center; gap: var(--space-2); }
.wh-range output { min-width: 44px; text-align: right; font: 13px var(--font); color: var(--text-muted); }
@media (max-width: 520px) { .wh-set-grid { grid-template-columns: 1fr; } }

/* the wheel */
.wh-stage { display: flex; flex-direction: column; align-items: center; }
.wh-wheel { width: 100%; max-width: 520px; aspect-ratio: 1; cursor: pointer; }
.wh-spin-row { margin-top: var(--space-3); }
.wh-spin { min-width: 160px; font-size: 17px; padding: 10px 24px; }
.wh-winner { display: flex; align-items: center; gap: 12px; width: 100%; box-sizing: border-box; margin-top: var(--space-3); padding: 10px 14px; border-radius: var(--radius); background: var(--surface-sunken); border: 1px solid rgba(255, 209, 102, .4); }
.wh-winner[hidden] { display: none; }
.wh-winner img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; }
.wh-win-text { flex: 1; min-width: 0; }
.wh-win-text small { display: block; color: #ffd166; font: 700 11px var(--font); letter-spacing: .06em; text-transform: uppercase; }
.wh-win-text b { display: block; font: 700 20px var(--font); overflow: hidden; text-overflow: ellipsis; }
.wh-win-text b a { color: inherit; }
.wh-win-text span { color: var(--text-muted); font-size: 13px; }
.wh-stage-note { margin: var(--space-2) 0 0; }

/* narrower screens: the entry list has a set height and scrolls */
@media (max-width: 1100px) {
  #wh-items { max-height: 440px; overflow-y: auto; margin-right: -6px; padding-right: 6px; }
}

/* wide screens: the page fits the window. Entries and the wheel side by side, the same height (the entry
   list scrolls inside its card); Settings under the entries. The wheel sizes itself to its card. */
@media (min-width: 1101px) {
  .wh-page { height: calc(100vh - var(--wh-top, 110px) - 16px); margin-bottom: 0; grid-template-rows: minmax(0, 1fr); }
  .wh-side { max-height: 100%; overflow-y: auto; box-sizing: border-box; }
  .wh-main, #wh-editor:not([hidden]) { display: flex; flex-direction: column; min-height: 0; height: 100%; }
  .wh-head { flex-shrink: 0; }
  .wh-grid { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "entries stage" "settings ."; align-items: stretch; }
  .wh-grid > .wh-col:first-child { display: contents; }
  .wh-entries { grid-area: entries; min-height: 0; display: flex; flex-direction: column; }
  #wh-items { flex: 1; min-height: 0; overflow-y: auto; margin-right: -6px; padding-right: 6px; }
  .wh-settings { grid-area: settings; }
  .wh-settings[open] { max-height: 45vh; overflow-y: auto; }
  .wh-stage-col { grid-area: stage; position: static; min-height: 0; }
  .wh-stage { height: 100%; box-sizing: border-box; overflow: hidden; container-type: size; }
  .wh-wheel { width: min(100%, calc(100cqh - 120px)); min-width: 200px; }
}

/* the streamer's lock for mods: locked = spin only */
.wh-lock { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.wh-lock.on { box-shadow: inset 0 0 0 1px #ff9a3c; color: #ffb36b; }
.wh-locked-note { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: #ffb36b; }
.wh-readonly .wh-edit-only { display: none !important; }
.wh-readonly .wh-name { pointer-events: none; background: transparent; box-shadow: none; border-color: transparent; padding-left: 0; }

/* share popup */
.wh-pop {
  position: absolute; z-index: 50; width: 300px; max-width: calc(100vw - 16px); box-sizing: border-box; padding: 12px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow);
  font: 13px/1.45 var(--font); color: var(--text);
}
.wh-pop p { margin: 6px 0 0; color: var(--text-muted); }
.wh-pop-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-3); }

.wh-wheel.off { opacity: .35; cursor: default; }

/* the landing page's wheels (wheel/landing.js) */
.ldw-wheel { width: 100%; max-width: 470px; aspect-ratio: 1; margin: 0 auto; cursor: pointer; }
.ldw-bar { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 12px; min-height: 40px; }
.ldw-win { font: 15px var(--font); color: var(--text-muted); }
.ldw-win b { color: var(--ok); }
.ldw-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; text-align: center; }
.ldw-trio span { font: 600 12px var(--font); color: var(--text-muted); }
.ldw-mini { aspect-ratio: 1; }
