:root {
  color-scheme: dark;
  --bg: #101112;
  --panel: #191b1f;
  --panel-2: #22252b;
  --text: #f4f2ed;
  --muted: #b6b1a8;
  --line: rgba(255, 255, 255, 0.22);
  --accent: #4fb477;
  --accent-strong: #62d58e;
  --warning: #e6bd5a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: #08090a;
}

.camera-shell {
  position: relative;
  min-height: 56vh;
  overflow: hidden;
  background: #111;
}

video {
  width: 100%;
  height: 100%;
  min-height: 56vh;
  object-fit: cover;
  display: block;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.grid-overlay span {
  position: absolute;
  background: var(--line);
}

.grid-overlay span:nth-child(1),
.grid-overlay span:nth-child(2) {
  top: 0;
  bottom: 0;
  width: 1px;
}

.grid-overlay span:nth-child(1) {
  left: 33.333%;
}

.grid-overlay span:nth-child(2) {
  left: 66.666%;
}

.grid-overlay span:nth-child(3),
.grid-overlay span:nth-child(4) {
  left: 0;
  right: 0;
  height: 1px;
}

.grid-overlay span:nth-child(3) {
  top: 33.333%;
}

.grid-overlay span:nth-child(4) {
  top: 66.666%;
}

.top-bar {
  position: absolute;
  top: env(safe-area-inset-top, 0);
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(rgba(0, 0, 0, 0.58), transparent);
}

h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.46);
  display: grid;
  place-items: center;
  font-size: 24px;
}

.status {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  min-height: 36px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.62);
  color: var(--muted);
  font-size: 14px;
}

.coach-arrow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  border-top: 14px solid var(--accent-strong);
  border-right: 14px solid var(--accent-strong);
  transform: rotate(45deg);
  filter: drop-shadow(0 2px 9px rgba(0, 0, 0, 0.55));
}

.coach-arrow.is-hidden {
  display: none;
}

.coach-arrow.move_left {
  transform: rotate(-135deg);
}

.coach-arrow.move_right {
  transform: rotate(45deg);
}

.coach-arrow.move_up,
.coach-arrow.raise_camera {
  transform: rotate(-45deg);
}

.coach-arrow.move_down,
.coach-arrow.lower_camera {
  transform: rotate(135deg);
}

.coach-arrow.move_closer {
  width: 92px;
  height: 92px;
  margin: -46px 0 0 -46px;
  border-width: 18px;
  transform: rotate(45deg) scale(1.05);
}

.controls {
  background: var(--panel);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0));
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.mode-tab {
  min-height: 38px;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 14px;
}

.mode-tab.is-active {
  background: var(--accent);
  color: #08140d;
  font-weight: 700;
}

.suggestion-panel {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #111316;
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--muted);
  font-size: 14px;
}

.score-row strong {
  color: var(--warning);
  font-size: 28px;
}

#summary {
  margin: 8px 0;
  line-height: 1.45;
}

#tips {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 14px;
}

.action-row {
  display: grid;
  grid-template-columns: 0.9fr 1.3fr;
  gap: 10px;
  margin-top: 12px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border-radius: 8px;
  font-weight: 700;
}

.primary-button {
  background: var(--accent-strong);
  color: #07120b;
}

.primary-button:disabled {
  opacity: 0.45;
}

.secondary-button {
  background: var(--panel-2);
  color: var(--text);
}

@media (min-width: 760px) {
  .app {
    max-width: 520px;
    margin: 0 auto;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
  }
}
