/* styles.css — Look Back Shiner */

:root {
  --bg-primary: #0A0A0A;
  --text-primary: #E8E8E8;
  --text-secondary: rgba(232, 232, 232, 0.5);
  --text-tertiary: rgba(232, 232, 232, 0.25);
  --accent: #C8E650;
  --accent-dim: rgba(200, 230, 80, 0.15);
  --error: #FF3B30;
  --error-dim: rgba(255, 59, 48, 0.15);
  --border-subtle: rgba(255, 255, 255, 0.06);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  line-height: 1.4;
  -webkit-text-size-adjust: none;
  user-select: none;
  -webkit-user-select: none;
}

.hidden {
  display: none !important;
}

/* ---- Config Screen ---- */

#config-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: env(safe-area-inset-top);
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

/* Camera Zone */
.camera-zone {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #111;
  overflow: hidden;
  flex-shrink: 0;
}

.camera-zone video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: linear-gradient(to bottom, transparent, var(--bg-primary));
  pointer-events: none;
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

.camera-placeholder.hidden { display: none; }

/* Controls */
.controls {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.control-row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.control-value {
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  color: var(--text-primary);
}

.control-value .unit {
  color: var(--text-tertiary);
}

.section-divider {
  height: 1px;
  background: var(--border-subtle);
}

/* Sliders */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 32px;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--progress, 50%),
    rgba(255, 255, 255, 0.08) var(--progress, 50%),
    rgba(255, 255, 255, 0.08) 100%
  );
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-primary);
  margin-top: -8.5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

input[type="range"]:active::-webkit-slider-thumb {
  box-shadow: 0 0 0 2px var(--accent), 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* Checklist */
.checklist {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.checklist .control-label {
  margin-bottom: 2px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 4px 0;
}

.checklist-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkmark {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
}

.checklist-item input:checked ~ .checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.checklist-item input:checked ~ .checkmark::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 6px;
  width: 5px;
  height: 9px;
  border: solid var(--bg-primary);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checklist-text {
  color: rgba(255, 255, 255, 0.7);
  transition: color 0.15s;
}

.checklist-item input:checked ~ .checklist-text {
  color: var(--text-primary);
}

/* Permission Items */
.permission-item {
  cursor: default;
}

.perm-dot {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
}

.permission-item.granted .perm-dot {
  background: var(--accent);
  border-color: var(--accent);
}

.permission-item.granted .perm-dot::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 6px;
  width: 5px;
  height: 9px;
  border: solid var(--bg-primary);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.permission-item.granted .checklist-text {
  color: var(--text-primary);
}

.permission-item.denied .perm-dot {
  border-color: var(--error);
  background: var(--error-dim);
}

.grant-btn {
  margin-left: auto;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.grant-btn:active {
  background: rgba(255, 255, 255, 0.06);
}

.permission-item.granted .grant-btn {
  display: none;
}

/* Start Footer */
.start-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 20px calc(env(safe-area-inset-bottom, 0px) + 12px);
  background: linear-gradient(to top, var(--bg-primary) 70%, transparent);
  text-align: center;
}

.start-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

#btn-practice {
  height: 56px;
  border: 1.5px solid var(--accent);
  border-radius: 14px;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.1s;
}

#btn-practice:active {
  transform: scale(0.98);
}

#btn-practice:disabled {
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.2);
  cursor: default;
}

#btn-practice:disabled:active {
  transform: none;
}

#btn-start {
  height: 56px;
  border: none;
  border-radius: 14px;
  background: var(--accent);
  color: var(--bg-primary);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.1s;
}

#btn-start:active {
  transform: scale(0.98);
}

#btn-start:disabled {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.2);
  cursor: default;
}

#btn-start:disabled:active {
  transform: none;
}

.start-helper {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-tertiary);
}

.start-helper.hidden {
  display: none;
}

/* ---- Black Screen ---- */

#black-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.black-fill {
  width: 100%;
  height: 100%;
  background: #000;
}

/* ---- Reveal Screen ---- */

#reveal-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#reveal-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---- Practice Screen ---- */

#practice-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
}

#practice-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleY(-1);
}

#practice-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.05s;
}

#practice-flash.active {
  opacity: 1;
  transition: none;
}

#practice-capture {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

#practice-capture.visible {
  opacity: 1;
}
