/* Layout rows / cols */

.layout-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.layout-col {
  flex: 1 1 280px;
  min-width: 0;
}

/* Video + canvas */

.video-wrapper {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #020617;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid #1f2937;
}

/* Video fills the width and keeps its real aspect ratio */
#camera {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
}

/* Canvas sits on top of the video, same visible size */
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}


.camera-status {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Panels & text boxes */

.panel {
  background: #0b1220; /* mid-navy */
  border-radius: 0.75rem;
  border: 1px solid #334155;
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
  color: #f1f5f9; /* ensure text inside is bright */
}


.panel h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.text-box {
  min-height: 2.5rem;
  border-radius: 0.5rem;
  padding: 0.5rem;

  background: #0f172a;     /* slightly lighter navy */
  border: 1px dashed #475569;
  
  color: #f1f5f9;          /* MUCH brighter text */
  font-size: 1.05rem;
  line-height: 1.5;
  word-wrap: break-word;
}


.text-box.small {
  max-height: 6rem;
  overflow-y: auto;
}

.text-area {
  width: 100%;
  border-radius: 0.5rem;
  padding: 0.5rem;

  background: #0f172a;   /* same as text-box */
  border: 1px solid #475569;
  color: #f8fafc;        /* bright white */
  
  resize: vertical;
}


/* Buttons */

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  cursor: pointer;
  background: #2563eb;
  color: white;
  transition: transform 0.05s ease, box-shadow 0.05s ease, opacity 0.1s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.5);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
  opacity: 0.85;
}

.btn-secondary {
  background: #374151;
}

.btn-accent {
  background: #10b981;
}

.btn-ghost {
  background: transparent;
  border: 1px solid #374151;
}

/* Choice panel (after line) */

.choice-panel {
  margin-top: 1rem;
}

/* Temp debug letters */

.temp-letters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* Highlight helpers for review/edit */

.line-item {
  padding: 0.2rem 0.3rem;
  border-radius: 0.4rem;
}

.line-item.active {
  background: rgba(56, 189, 248, 0.3);
}

.word-item {
  padding: 0.1rem 0.2rem;
  border-radius: 0.35rem;
}

.word-item.active {
  background: rgba(245, 158, 11, 0.4);
}

/* Sections visibility (we'll toggle via JS by adding/removing .hidden) */

section {
  display: none;
}

section.active {
  display: block;
}

/* Simple .hidden utility */
.hidden {
  display: none !important;
}

/* Mobile tweaks */
@media (max-width: 768px) {
  body {
    padding: 0.75rem;
  }

  main {
    padding: 0.75rem;
  }

  .btn {
    flex: 1 1 100%;
    text-align: center;
  }
}

/* Layout rows / cols */

.layout-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.layout-col {
  flex: 1 1 280px;
  min-width: 0;
}

/* Video + canvas */

.video-wrapper {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #020617;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid #1f2937;
}

/* Video: normal flow, sets the height of the wrapper */
#camera {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
}

/* Canvas: overlays on top of whatever size the video ends up being */
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}


.camera-status {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Panels & text boxes */

.panel {
  background: #020617;
  border-radius: 0.75rem;
  border: 1px solid #1f2937;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.panel h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.text-box {
  min-height: 2.5rem;
  border-radius: 0.5rem;
  padding: 0.5rem;
  background: #020617;
  border: 1px dashed #374151;
  font-size: 1rem;
  line-height: 1.4;
  word-wrap: break-word;
}

.text-box.small {
  max-height: 6rem;
  overflow-y: auto;
}

.text-area {
  width: 100%;
  border-radius: 0.5rem;
  padding: 0.5rem;
  border: 1px solid #374151;
  background: #020617;
  color: #e5e7eb;
  resize: vertical;
}

/* Buttons */

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  cursor: pointer;
  background: #2563eb;
  color: white;
  transition: transform 0.05s ease, box-shadow 0.05s ease, opacity 0.1s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.5);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
  opacity: 0.85;
}

.btn-secondary {
  background: #374151;
}

.btn-accent {
  background: #10b981;
}

.btn-ghost {
  background: transparent;
  border: 1px solid #374151;
}

/* Choice panel (after line) */

.choice-panel {
  margin-top: 1rem;
}

/* Temp debug letters */

.temp-letters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* Highlight helpers for review/edit */

.line-item {
  padding: 0.2rem 0.3rem;
  border-radius: 0.4rem;
}

.line-item.active {
  background: rgba(56, 189, 248, 0.3);
}

.word-item {
  padding: 0.1rem 0.2rem;
  border-radius: 0.35rem;
}

.word-item.active {
  background: rgba(245, 158, 11, 0.4);
}

/* Sections visibility (we'll toggle via JS by adding/removing .hidden) */

section {
  display: none;
}

section.active {
  display: block;
}

/* Simple .hidden utility */
.hidden {
  display: none !important;
}

/* === Sign confirmation preview === */

.sign-confirmation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.sign-letter {
  font-size: 3rem;
  font-weight: 600;
  min-width: 3rem;
  text-align: center;
}

.sign-circle {
  width: 72px;
  height: 72px;
  transform: rotate(-90deg); /* so progress starts at top */
}

.sign-circle-bg {
  fill: none;
  stroke: #1f2937;      /* dark gray background circle */
  stroke-width: 8;
}

.sign-circle-fg {
  fill: none;
  stroke: #22c55e;      /* green progress */
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 251;   /* 2 * π * r (r=40) */
  stroke-dashoffset: 251;  /* 0% filled */
  transition: stroke-dashoffset 0.15s linear;
}

/* === Modal overlay for "Next Step" === */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6); /* dark translucent */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-panel {
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

/* Mobile tweaks */
@media (max-width: 768px) {
  body {
    padding: 0.75rem;
  }

  main {
    padding: 0.75rem;
  }

  .btn {
    flex: 1 1 100%;
    text-align: center;
  }
}

/* === Global theme overrides (visual refinement) === */

:root {
  --bg-body: #020617;      /* overall page */
  --bg-panel: #020314;     /* panels/boxes - darker */
  --bg-textbox: #020617;   /* text areas inside panels */
  --border-subtle: #1f2937;
  --text-main: #e5e7eb;
}

/* Page layout & typography */

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #0b1120 0, #020617 55%, #020617 100%);
  color: var(--text-main);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

header {
  text-align: center;
  padding: 1.25rem 1rem 0.5rem;
}

header h1 {
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin: 0;
}

main {
  max-width: 1120px;
  margin: 0 auto 2rem;
  padding: 0 1.25rem 2rem;
}

.video-wrapper {
  position: relative;
  width: 100%;
  max-width: 720px;
  background: #020617;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}


/* Panels & text boxes themed */

.panel {
  background: var(--bg-panel);   /* darker than body */
  border-radius: 0.75rem;
  border: 1px solid var(--border-subtle);
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.text-box {
  min-height: 2.5rem;
  border-radius: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-textbox);   /* a bit brighter than panel */
  border: 1px dashed #374151;
  color: #f9fafb;
  font-size: 1.05rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.text-box.small {
  max-height: 6rem;
  overflow-y: auto;
}

.text-area {
  width: 100%;
  border-radius: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-textbox);
  border: 1px solid #374151;
  color: #f9fafb;
  resize: vertical;
}

/* Buttons – just slightly nicer defaults */

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  font-size: 0.95rem;
  cursor: pointer;
  background: #2563eb;
  color: white;
  transition: transform 0.05s ease, box-shadow 0.05s ease, opacity 0.1s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.6);
}

.btn-secondary {
  background: #4b5563;
}

.btn-accent {
  background: #10b981;
}

.btn-ghost {
  background: transparent;
  border: 1px solid #374151;
}

/* Keep modal nice on dark background */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-panel {
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* === Button Redesign === */

.btn {
  position: relative;
  overflow: hidden;
  border: none;
  border-radius: 10px;  
  padding: 0.65rem 1.25rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.35);
}

.btn:active {
  transform: translateY(0);
  opacity: 0.9;
}

/* Secondary button: gray with sheen */
.btn-secondary {
  background: linear-gradient(135deg, #4b5563, #374151);
}

/* Accent (green confirm buttons) */
.btn-accent {
  background: linear-gradient(135deg, #10b981, #059669);
}

/* Transparent / ghost button */
.btn-ghost {
  color: #cbd5e1;
  background: transparent;
  border: 1px solid #475569;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Slight shine animation on hover */
.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -150%;
  width: 150%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255, 255, 255, 0.25) 50%,
    transparent 100%
  );
  transform: skewX(-20deg);
  transition: left 0.4s ease;
}

.btn:hover::before {
  left: 150%;
}
