/* SpinReel app UI — interactive tool styles */

.app-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(13,12,10,0.95);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-wordmark {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.session-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.session-label {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Main layout */
.app-main {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  height: calc(100vh - 56px);
  overflow: hidden;
}

/* Sidebar */
.app-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.panel {
  padding: 20px;
}

.panel-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 14px;
}

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

.panel-header .panel-label { margin-bottom: 0; }

/* Upload panel */
.upload-panel {
  border-bottom: 1px solid var(--border);
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 24px 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
  min-height: 100px;
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--amber);
  background: rgba(232,168,56,0.04);
}

.dz-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.dz-idle svg { opacity: 0.5; }

.dz-idle span {
  font-size: 13px;
  line-height: 1.5;
}

.dz-idle small {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.7;
}

.dz-loaded {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.dz-count {
  font-family: var(--font-head);
  font-size: 36px;
  font-weight: 800;
  color: var(--amber);
  line-height: 1;
}

.dz-unit {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

/* Pool stats */
.pool-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-num {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-lbl {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stat-div {
  width: 1px;
  height: 32px;
  background: var(--border);
}

/* History panel */
.history-panel {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.history-empty {
  font-size: 13px;
  color: var(--text-muted);
  padding: 12px 0;
  line-height: 1.6;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(42,39,34,0.6);
  animation: slideIn 0.25s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.history-num {
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 600;
  color: var(--amber);
  width: 22px;
  flex-shrink: 0;
}

.history-thumb {
  width: 36px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
}

.history-name {
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-time {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: auto;
}

/* Center stage */
.app-center {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg);
  position: relative;
}

.spinner-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: 100%;
  max-width: 600px;
  padding: 32px;
}

.spinner-stage {
  width: 100%;
  aspect-ratio: 16/10;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.04);
}

/* Scan lines overlay */
.scan-lines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.06) 3px,
    rgba(0,0,0,0.06) 4px
  );
  pointer-events: none;
  z-index: 10;
}

.pick-display {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Reel spinning strips */
.reel-strips {
  position: absolute;
  inset: 0;
  display: flex;
  gap: 3px;
  padding: 0;
  overflow: hidden;
}

.reel-strip {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  /* will be populated with img elements dynamically */
}

.reel-strip img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  flex-shrink: 0;
  border-radius: 2px;
}

/* Individual strip animation — vertical scroll */
@keyframes stripScroll {
  0%   { transform: translateY(0); }
  100% { transform: translateY(-60%); }
}

.strip-spinning {
  animation: stripScroll linear infinite;
}

/* Pick preview */
.pick-preview {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pick-img-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pick-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  opacity: 0.5;
}

.pick-placeholder span {
  font-size: 14px;
}

.pick-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-height: 320px;
  border-radius: 4px;
}

/* Reveal animation */
@keyframes revealPop {
  0%   { opacity: 0; transform: scale(0.92); }
  60%  { transform: scale(1.02); }
  100% { opacity: 1; transform: scale(1); }
}

.pick-img.revealed {
  animation: revealPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Name / meta below stage */
.pick-name {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  min-height: 26px;
  letter-spacing: -0.01em;
  transition: opacity 0.2s;
}

.pick-meta {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  min-height: 18px;
  text-align: center;
}

/* Spin CTA */
.spin-cta {
  background: var(--amber);
  color: #0d0c0a;
  border: none;
  border-radius: 12px;
  padding: 16px 48px;
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s, opacity 0.15s;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 24px rgba(232,168,56,0.3);
}

.spin-cta:hover:not(:disabled) {
  background: #f0b84a;
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(232,168,56,0.4);
}

.spin-cta:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(232,168,56,0.2);
}

.spin-cta:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.spin-cta-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.spin-cta-icon {
  transition: transform 0.6s ease;
}

.spinning-btn .spin-cta-icon {
  animation: spinIcon 0.6s linear infinite;
}

@keyframes spinIcon {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Done state */
.reel-done {
  text-align: center;
  padding: 32px;
}

.done-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.reel-done h3 {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 10px;
}

.reel-done p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* Buttons */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 7px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.btn-ghost.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}

.btn-primary {
  background: var(--amber);
  color: #0d0c0a;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn-primary:hover {
  background: #f0b84a;
  transform: translateY(-1px);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
}

.modal-title {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
}

.modal-body {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

.modal-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  margin-bottom: 20px;
  outline: none;
  transition: border-color 0.15s;
}

.modal-input:focus {
  border-color: var(--amber);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 24px;
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2000;
  pointer-events: none;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
  .app-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    overflow: auto;
  }
  .app-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .history-panel {
    max-height: 240px;
  }
  .spinner-wrapper {
    padding: 20px;
  }
  .app-body {
    overflow: auto;
  }
}
