/* ==========================================================================
   One Matchstick — Tactile 7-Segment Matchstick Board Styles
   ========================================================================== */

.om-shell {
  padding-block: 28px 48px;
}

.om-intro-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.om-title {
  font-size: clamp(1.5rem, 2.8vw, 2rem);
  font-weight: 800;
  color: var(--pl-navy);
  margin-bottom: 6px;
}

.om-subtitle {
  color: var(--pl-text-secondary);
  max-width: 68ch;
  margin-bottom: 0;
  font-size: 0.96rem;
}

.om-top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* HUD */
.om-hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) 1.4fr;
  gap: 12px;
  align-items: center;
  background: var(--pl-surface);
  border: 1.5px solid var(--pl-border);
  border-radius: var(--pl-radius-md);
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: var(--pl-shadow-sm);
}

.om-hud-stat {
  display: flex;
  flex-direction: column;
}

.om-hud-stat__val {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--pl-navy);
  line-height: 1.2;
}

.om-hud-stat__lbl {
  font-size: 0.78rem;
  color: var(--pl-text-muted);
  font-weight: 600;
}

.om-hud-progress__label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--pl-navy);
  margin-bottom: 6px;
}

/* Stepper */
.om-stepper {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.om-step {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: var(--pl-radius-sm);
  border: 1.5px solid var(--pl-border);
  background: var(--pl-surface);
  color: var(--pl-text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.om-step.is-current {
  border-color: var(--pl-navy);
  background: var(--pl-navy);
  color: var(--pl-gold);
}

.om-step.is-solved {
  border-color: var(--pl-success-border);
  background: var(--pl-success-bg);
  color: var(--pl-success);
}

/* Board Container */
.om-stage-card {
  background: var(--pl-navy);
  border: 2px solid var(--pl-navy-soft);
  border-top: 5px solid var(--pl-gold);
  border-radius: var(--pl-radius-lg);
  padding: 24px 20px 28px;
  margin-bottom: 18px;
  box-shadow: var(--pl-shadow-md);
  color: #FFFFFF;
}

.om-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.om-stage-head__title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #FFFFFF;
  margin: 0;
}

.om-stage-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--pl-radius-pill);
  background: rgba(242, 183, 5, 0.16);
  border: 1px solid rgba(242, 183, 5, 0.45);
  color: var(--pl-gold);
  font-size: 0.85rem;
  font-weight: 700;
}

/* Explicit LTR Equation Layout */
.om-equation-row {
  direction: ltr;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  padding-block: 10px;
}

/* 7-Segment Digit Box */
.om-digit {
  position: relative;
  width: 96px;
  height: 168px;
  flex-shrink: 0;
}

/* Operator Box (+ / -) */
.om-operator {
  position: relative;
  width: 68px;
  height: 168px;
  flex-shrink: 0;
}

/* Fixed Equals Sign */
.om-equals {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  width: 56px;
  height: 168px;
  align-items: center;
  flex-shrink: 0;
}

.om-equals-bar {
  width: 46px;
  height: 12px;
  border-radius: 6px;
  background: #E2E8F0;
  opacity: 0.85;
}

/* Matchstick Segment Buttons */
.om-seg {
  position: absolute;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.om-seg:disabled {
  cursor: default;
}

/* Horizontal segments: 0 (top), 3 (bottom), 6 (middle) */
.om-seg--h {
  width: 66px;
  height: 22px;
  left: 15px;
}

.om-seg--0 { top: 0; }
.om-seg--6 { top: 73px; }
.om-seg--3 { bottom: 0; }

/* Vertical segments: 1 (topR), 2 (botR), 4 (botL), 5 (topL) */
.om-seg--v {
  width: 22px;
  height: 66px;
}

.om-seg--5 { top: 14px; left: 0; }
.om-seg--1 { top: 14px; right: 0; }
.om-seg--4 { bottom: 14px; left: 0; }
.om-seg--2 { bottom: 14px; right: 0; }

/* Operator segments */
.om-seg--op-h {
  width: 64px;
  height: 24px;
  left: 2px;
  top: 72px;
}

.om-seg--op-v {
  width: 24px;
  height: 64px;
  left: 22px;
  top: 52px;
}

/* Visual Matchstick Inside Segment Button */
.om-stick {
  display: block;
  position: relative;
  border-radius: 999px;
  transition: background-color 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.om-seg--h .om-stick,
.om-seg--op-h .om-stick {
  width: 56px;
  height: 11px;
}

.om-seg--v .om-stick,
.om-seg--op-v .om-stick {
  width: 11px;
  height: 56px;
}

/* Empty slot */
.om-seg.is-empty .om-stick {
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px dashed rgba(255, 255, 255, 0.22);
}

.om-seg.is-empty.is-targetable:hover:not(:disabled) .om-stick {
  background: rgba(242, 183, 5, 0.28);
  border-color: var(--pl-gold);
}

/* Lit wooden matchstick with red match head */
.om-seg.is-lit .om-stick {
  background: linear-gradient(90deg, #E2A856 0%, #C68334 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.om-seg--v.is-lit .om-stick,
.om-seg--op-v.is-lit .om-stick {
  background: linear-gradient(180deg, #E2A856 0%, #C68334 100%);
}

.om-seg.is-lit .om-stick::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: #DC2626;
  border: 1px solid #7F1D1D;
}

.om-seg--h.is-lit .om-stick::after,
.om-seg--op-h.is-lit .om-stick::after {
  width: 13px;
  height: 13px;
  right: -2px;
  top: -1px;
}

.om-seg--v.is-lit .om-stick::after,
.om-seg--op-v.is-lit .om-stick::after {
  width: 13px;
  height: 13px;
  top: -2px;
  left: -1px;
}

/* Picked state */
.om-seg.is-picked {
  transform: scale(1.1);
  z-index: 4;
}

.om-seg.is-picked .om-stick {
  background: var(--pl-gold);
  box-shadow: 0 0 0 3px rgba(242, 183, 5, 0.55), 0 6px 14px rgba(0, 0, 0, 0.45);
}

.om-seg.is-moved-dest .om-stick {
  box-shadow: 0 0 0 2.5px #22C55E, 0 4px 10px rgba(0, 0, 0, 0.35);
}

.om-stage-guide {
  margin-top: 18px;
  text-align: center;
  font-size: 0.86rem;
  color: #CBD5E1;
}

/* Proof Box */
.om-proof-box {
  background: var(--pl-success-bg);
  border: 1.5px solid var(--pl-success-border);
  border-radius: var(--pl-radius-md);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.om-proof-box__title {
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--pl-success);
  margin-bottom: 6px;
}

.om-proof-box__text {
  font-size: 0.94rem;
  color: var(--pl-text);
  margin-bottom: 14px;
}

/* Controls & Feedback */
.om-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--pl-surface);
  border: 1.5px solid var(--pl-border);
  border-radius: var(--pl-radius-md);
  padding: 16px;
}

.om-controls__primary,
.om-controls__secondary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.om-feedback {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: var(--pl-radius-sm);
  font-weight: 700;
  font-size: 0.92rem;
  border: 1px solid transparent;
}

.om-feedback--info {
  background: var(--pl-info-bg);
  color: var(--pl-info);
  border-color: var(--pl-info-border);
}

.om-feedback--error {
  background: var(--pl-danger-bg);
  color: var(--pl-danger);
  border-color: var(--pl-danger-border);
}

.om-result-wrap {
  margin-top: 22px;
}

.om-about-puzzle {
  margin-top: 32px;
  background: var(--pl-surface);
  border: 1px solid var(--pl-border);
  border-radius: var(--pl-radius-md);
  padding: 24px;
}

.om-about-puzzle h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--pl-navy);
  margin-bottom: 10px;
}

.om-about-puzzle ul {
  margin: 0;
  padding-right: 20px;
  color: var(--pl-text-secondary);
}

.om-about-puzzle li {
  margin-bottom: 6px;
}

@media (max-width: 960px) {
  .om-hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .om-hud-progress {
    grid-column: 1 / -1;
  }

  .om-stepper {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .om-equation-row {
    gap: 10px;
  }

  .om-digit {
    width: 68px;
    height: 124px;
  }

  .om-operator {
    width: 48px;
    height: 124px;
  }

  .om-equals {
    width: 36px;
    height: 124px;
    gap: 12px;
  }

  .om-equals-bar {
    width: 30px;
    height: 9px;
  }

  .om-seg--h {
    width: 46px;
    height: 18px;
    left: 11px;
  }

  .om-seg--6 { top: 53px; }

  .om-seg--v {
    width: 18px;
    height: 46px;
  }

  .om-seg--5, .om-seg--1 { top: 10px; }
  .om-seg--4, .om-seg--2 { bottom: 10px; }

  .om-seg--op-h {
    width: 44px;
    height: 18px;
    left: 2px;
    top: 53px;
  }

  .om-seg--op-v {
    width: 18px;
    height: 44px;
    left: 15px;
    top: 40px;
  }

  .om-seg--h .om-stick,
  .om-seg--op-h .om-stick {
    width: 38px;
    height: 8px;
  }

  .om-seg--v .om-stick,
  .om-seg--op-v .om-stick {
    width: 8px;
    height: 38px;
  }

  .om-controls__primary,
  .om-controls__secondary,
  .om-controls .pl-btn {
    width: 100%;
  }
}
