html, body { background: var(--bg-base, #0a0a0a); color: var(--text-primary); }
body { margin: 0; font-family: 'Space Grotesk', system-ui, sans-serif; }

.rf-shell { max-width: 880px; margin: 0 auto; padding: 18px 22px 64px; }

.rf-top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.rf-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 6px;
  background: var(--primary-soft, rgba(214,231,15,0.12)); color: var(--primary);
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; text-decoration: none;
  transition: background 0.12s;
}
.rf-back:hover { background: rgba(214,231,15,0.22); }
.rf-back-arrow { display: inline-block; width: 14px; height: 14px; }
.rf-cog {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer;
  width: 36px; height: 36px; border-radius: 8px;
  font-size: 16px; line-height: 1; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.rf-cog:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft, rgba(214,231,15,0.08)); }

.rf-header-img {
  width: 100%; aspect-ratio: 4 / 1;
  border-radius: 10px; overflow: hidden;
  background: var(--bg-card);
  display: block;
}
.rf-header-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.rf-page-title {
  font-size: 32px; font-weight: 700; letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 22px 0 4px;
  text-align: center;
}
.rf-page-sub {
  font-size: 13px; color: var(--text-secondary);
  text-align: center; margin: 10px 0 26px;
}
.rf-page-sub a {
  color: var(--primary); text-decoration: none;
}

.rf-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 14px;
}

/* ===== Pot card ===== */
.rf-pot-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px; align-items: end;
}
.rf-pot-col-countdown { text-align: right; }
.rf-pot-label {
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-secondary); font-weight: 600;
  margin-bottom: 4px;
}
.rf-pot-value {
  font-size: 26px; font-weight: 700; color: var(--primary);
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.rf-my-row {
  display: flex; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; align-items: center;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-secondary);
}
.rf-my-stats { display: inline-flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.rf-my-stats b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.rf-my-sep { color: var(--text-muted); }
.rf-my-validate { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rf-my-projection {
  font-size: 12px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
}
.rf-my-projection:empty { display: none; margin-top: 0; }

/* ===== Validate (inline inside pot card) ===== */
.rf-validate-label {
  font-size: 14px; color: var(--text-secondary); font-weight: 600;
}
.rf-input {
  flex: 1; min-width: 180px;
  background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text-primary); border-radius: 6px;
  padding: 10px 14px; font-size: 14px; font-family: inherit;
  outline: none; transition: border-color 0.12s, box-shadow 0.12s;
}
.rf-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(214,231,15,0.15); }
.rf-input::placeholder { color: var(--text-muted); }
.rf-validate-qty {
  flex: 0 0 auto; width: 80px; min-width: 0;
  text-align: center; font-variant-numeric: tabular-nums;
  font-weight: 600;
  padding: 7px 10px; font-size: 13px;
}
.rf-validate-status {
  font-size: 12px; min-height: 16px;
  color: var(--text-dim, var(--text-muted));
  margin-top: 8px;
}
.rf-validate-status:empty { display: none; margin-top: 0; }

.rf-btn {
  background: var(--primary); color: #0d0d0d;
  border: 1px solid transparent; border-radius: 6px;
  padding: 10px 18px; font-size: 13px; font-weight: 700;
  letter-spacing: 0.04em; cursor: pointer; font-family: inherit;
  transition: opacity 0.12s, background 0.12s, color 0.12s;
}
.rf-btn:hover { opacity: 0.92; }
.rf-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.rf-btn-primary { background: var(--primary); color: #0d0d0d; }
.rf-btn-ghost {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border);
}
.rf-btn-ghost:hover { color: var(--text-primary); border-color: var(--text-secondary); background: var(--bg-input); }
.rf-btn-danger { background: var(--red); color: #fff; }
.rf-btn-sm { padding: 7px 12px; font-size: 12px; }

.rf-validate-status {
  font-size: 12px; min-height: 16px; margin-top: 10px;
  color: var(--text-dim, var(--text-muted));
}
.rf-validate-status.ok    { color: var(--positive, #69DB7C); }
.rf-validate-status.wait  { color: var(--gold); }
.rf-validate-status.error { color: var(--red); }

/* ===== Letterbox ===== */
.rf-letterbox {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 14px;
  margin: 18px 0;
  display: flex; flex-direction: column; gap: 4px;
  position: relative;
  overflow: hidden;
}
.rf-letterbox::before, .rf-letterbox::after {
  content: ''; position: absolute; left: 0; right: 0;
  height: 28px; pointer-events: none; z-index: 1;
}
.rf-letterbox::before {
  top: 0; background: linear-gradient(180deg, var(--bg-card) 0%, rgba(22,22,24,0) 100%);
}
.rf-letterbox::after {
  bottom: 0; background: linear-gradient(0deg, var(--bg-card) 0%, rgba(22,22,24,0) 100%);
}
.rf-lb-slot {
  font-size: 16px; font-weight: 600;
  text-align: center; padding: 8px 12px;
  color: var(--text-primary);
  line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: filter 0.3s, opacity 0.3s, color 0.3s;
}
.rf-lb-blur {
  filter: blur(6px);
  opacity: 0.55;
}
.rf-lb-above-2, .rf-lb-below-2 { opacity: 0.32; }

/* During spin: all 5 slots show real names, no blur, tiered opacity for depth */
.rf-letterbox.rf-lb-spinning .rf-lb-blur { filter: none; opacity: 1; }
.rf-letterbox.rf-lb-spinning .rf-lb-above-1, .rf-letterbox.rf-lb-spinning .rf-lb-below-1 { opacity: 0.7; }
.rf-letterbox.rf-lb-spinning .rf-lb-above-2, .rf-letterbox.rf-lb-spinning .rf-lb-below-2 { opacity: 0.4; }
.rf-letterbox.rf-lb-spinning .rf-lb-center { font-size: 24px; font-weight: 700; }
.rf-lb-center {
  font-size: 22px;
  color: var(--primary);
  background: var(--primary-soft, rgba(214,231,15,0.10));
  border-top: 1px solid rgba(214,231,15,0.30);
  border-bottom: 1px solid rgba(214,231,15,0.30);
  padding: 14px 12px;
  margin: 4px 0;
  letter-spacing: -0.005em;
  position: relative; z-index: 2;
}
.rf-lb-center.rf-lb-settled {
  font-size: 24px; font-weight: 700;
  background: linear-gradient(180deg, rgba(214,231,15,0.18), rgba(214,231,15,0.06));
  border-color: var(--primary);
}
.rf-letterbox.rf-no-entries .rf-lb-center {
  color: var(--text-secondary); font-size: 16px;
  background: var(--bg-input);
  border-color: var(--border);
}

/* ===== History ===== */
.rf-history-title {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-secondary); font-weight: 700;
  margin-bottom: 14px;
}
.rf-history-list { display: flex; flex-direction: column; gap: 6px; }
.rf-history-row {
  display: grid; grid-template-columns: auto 1fr auto auto;
  gap: 12px; align-items: baseline;
  padding: 10px 12px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
.rf-history-row .rf-h-date {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-secondary); white-space: nowrap;
}
.rf-history-row .rf-h-name { color: var(--text-primary); font-weight: 600; }
.rf-history-row .rf-h-pot {
  color: var(--primary); font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.rf-history-row .rf-h-tickets {
  color: var(--text-muted); font-size: 11px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.rf-history-row.rf-h-noentries {
  opacity: 0.55;
}
.rf-history-row.rf-h-noentries .rf-h-name { color: var(--text-muted); font-style: italic; font-weight: 500; }

.rf-loading {
  text-align: center; padding: 20px 12px;
  font-size: 13px; color: var(--text-muted);
}

/* ===== Settings modal ===== */
.rf-settings-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 700; padding: 20px;
}
.rf-settings-modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; max-width: 620px; width: 100%;
  max-height: 90vh; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
}
.rf-settings-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.rf-settings-title { font-size: 15px; font-weight: 700; }
.rf-settings-close {
  background: transparent; border: none;
  color: var(--text-secondary); cursor: pointer;
  font-size: 24px; line-height: 1; padding: 0 6px;
}
.rf-settings-close:hover { color: var(--text-primary); }
.rf-settings-body { padding: 16px 18px; overflow-y: auto; }

.rf-set-section { margin-bottom: 20px; }
.rf-set-section:last-child { margin-bottom: 0; }
.rf-set-section-title {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  font-weight: 700; color: var(--primary);
  margin-bottom: 10px;
}
.rf-set-helper {
  font-size: 11.5px; color: var(--text-muted); line-height: 1.4;
  margin-bottom: 8px;
}
.rf-set-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  align-items: center;
  margin-bottom: 8px;
}
.rf-set-label {
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary); flex-basis: 110px;
}
.rf-set-input { flex: 0 1 130px; min-width: 80px; }
.rf-set-input-narrow { flex: 0 1 90px; min-width: 70px; }
#rfManualMember { font-size: 12px; }
.rf-set-status {
  font-size: 12px; min-height: 16px; margin-top: 4px;
  color: var(--text-dim, var(--text-muted));
}
.rf-set-status.ok    { color: var(--positive, #69DB7C); }
.rf-set-status.error { color: var(--red); }
.rf-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-secondary); cursor: pointer;
  user-select: none;
}
.rf-toggle input[type="checkbox"] {
  width: 14px; height: 14px; cursor: pointer; accent-color: var(--primary);
}

.rf-log-list {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 320px; overflow-y: auto;
  background: var(--bg-base, #0a0a0a);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 6px;
  margin-bottom: 8px;
}
.rf-log-row {
  display: grid; grid-template-columns: auto 1fr auto auto;
  gap: 10px; align-items: baseline;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid transparent;
}
.rf-log-row.rf-log-row-manual {
  border-color: var(--gold);
  background: rgba(255,212,59,0.04);
}
.rf-log-row.rf-log-row-noncounted .rf-log-sender,
.rf-log-row.rf-log-row-noncounted .rf-log-msg,
.rf-log-row.rf-log-row-noncounted .rf-log-qty {
  text-decoration: line-through;
  color: var(--text-muted);
}
.rf-log-row .rf-log-void {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); font-size: 11px;
  width: 22px; height: 22px; line-height: 1;
  border-radius: 4px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.rf-log-row .rf-log-void:hover {
  color: var(--red); border-color: var(--red);
  background: rgba(239,68,68,0.08);
}
.rf-log-row .rf-log-void:disabled { opacity: 0.5; cursor: wait; }
.rf-log-row:hover { background: var(--bg-input); }
.rf-log-row .rf-log-ts {
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--text-muted); white-space: nowrap;
}
.rf-log-row .rf-log-sender { color: var(--text-primary); }
.rf-log-row .rf-log-msg {
  font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rf-log-row .rf-log-qty {
  font-variant-numeric: tabular-nums;
  color: var(--text-primary); font-weight: 600;
}
.rf-log-more-row { display: flex; justify-content: center; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .rf-shell { padding: 14px 14px 48px; }
  .rf-page-title { font-size: 26px; }
  .rf-pot-value { font-size: 22px; }
  .rf-lb-center { font-size: 18px; }
  .rf-lb-center.rf-lb-settled { font-size: 20px; }
  .rf-history-row {
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
  }
  .rf-history-row .rf-h-date { grid-column: 1 / -1; }
  .rf-history-row .rf-h-tickets { grid-column: 1 / -1; }
  .rf-validate-row .rf-btn { flex: 1; }
  .rf-my-validate {
    width: 100%;
    flex-wrap: nowrap;
    align-items: center;
  }
  .rf-my-validate .rf-validate-qty { width: 70px; flex-shrink: 0; }
  .rf-my-validate .rf-btn { margin-left: auto; flex-shrink: 0; }
  .rf-set-label { flex-basis: 100%; }
  .rf-set-input { flex: 1 1 auto; min-width: 0; }
  .rf-set-row .rf-btn { flex-shrink: 0; }
  .rf-set-row:has(.rf-toggle) .rf-set-input { flex: 0 0 80px; min-width: 60px; }
  .rf-set-row:has(.rf-toggle) .rf-toggle { flex: 1 1 auto; }
  .rf-set-row:has(#rfManualMember) .rf-btn { width: 90px; flex: 0 0 90px; }
  .rf-set-row:has(#rfLogSearch) #rfLogSearch { flex: 1 1 100%; min-width: 0; }
  .rf-set-row:has(#rfLogSearch) .rf-btn { flex: 1 1 0; min-width: 0; }
  .rf-log-row {
    align-items: start;
    column-gap: 8px;
  }
  .rf-log-row .rf-log-ts .rf-log-date,
  .rf-log-row .rf-log-ts .rf-log-time { display: block; line-height: 1.25; }
  .rf-log-row .rf-log-sender { min-width: 0; }
  .rf-log-row .rf-log-msg {
    display: block; white-space: normal; overflow: visible;
    text-overflow: clip; margin-top: 2px;
  }
  .rf-log-row .rf-log-qty { white-space: nowrap; }
  .rf-log-row .rf-log-void { align-self: start; }
}
