:root {
  font-family: "Segoe UI", Arial, sans-serif;
  color: #302f25;
  background: #efe7d6;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #302f25;
  --muted: #777363;
  --line: #dfd1b8;
  --paper: #fffaf0;
  --green: #496449;
  --green-dark: #293e31;
  --green-soft: #edf0e4;
  --gold: #a77b3e;
  --terracotta: #ad694b;
  --error: #9b4f47;
  --shadow: 0 22px 60px rgba(67, 52, 32, .12);
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background-color: #efe7d6;
  background-image: radial-gradient(ellipse at 12% 10%, rgba(170, 126, 67, .10), transparent 32%), radial-gradient(ellipse at 86% 78%, rgba(69, 96, 69, .09), transparent 34%), repeating-linear-gradient(0deg, rgba(111, 92, 57, .018) 0, rgba(111, 92, 57, .018) 1px, transparent 1px, transparent 5px);
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
.hidden { display: none !important; }

.page-shell { position: relative; width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.brand-header { height: 88px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font: 800 20px/1 "Segoe UI", Arial, sans-serif; letter-spacing: -.7px; }
.brand-mark { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid #b58d53; border-radius: 11px; background: var(--green-dark); color: #fff8e9; font: 800 18px "Segoe UI", Arial, sans-serif; box-shadow: inset 0 0 0 2px rgba(255, 248, 233, .12); }
.brand-accent { color: var(--green); }
.prototype-label { color: #7b806f; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

.auth-layout { min-height: calc(100vh - 148px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); align-items: center; gap: clamp(44px, 8vw, 120px); padding: 30px 5vw 70px; }
.intro-panel { max-width: 520px; }
.eyebrow { margin: 0 0 13px; color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: .15em; }
h1, h2, p { margin-top: 0; }
.intro-panel h1, .home-card h1 { max-width: 540px; margin-bottom: 18px; font: 800 clamp(36px, 5vw, 56px)/1.08 "Segoe UI", Arial, sans-serif; letter-spacing: -2px; }
.intro-copy { max-width: 430px; color: var(--muted); font-size: 17px; line-height: 1.65; }
.privacy-note { max-width: 390px; display: grid; gap: 6px; margin-top: 50px; padding: 17px 19px; border: 1px solid #d7c69f; border-left: 4px solid var(--terracotta); border-radius: 4px 13px 13px 4px; background: rgba(255, 250, 238, .76); color: #655f4a; font-size: 13px; line-height: 1.5; }
.privacy-note strong { color: #385844; }

.auth-card, .home-card { padding: clamp(25px, 4vw, 36px); border: 1px solid #dbccb0; border-radius: 19px; background: linear-gradient(145deg, rgba(255, 252, 244, .98), rgba(250, 244, 229, .98)); box-shadow: var(--shadow); }
.card-heading { margin-bottom: 24px; }
.card-heading h2, .register-step h2 { margin: 0 0 8px; font: 750 25px/1.2 "Segoe UI", Arial, sans-serif; letter-spacing: -.7px; }
.card-heading > p:last-child, .register-step > p:not(.eyebrow) { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0 17px; border: 1px solid transparent; border-radius: 11px; font-size: 13px; font-weight: 700; transition: background .15s ease, transform .15s ease, border-color .15s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button-primary { border-color: #263d30; background: linear-gradient(135deg, #486249, #293e31); color: #fffaf0; box-shadow: 0 5px 12px rgba(41, 62, 49, .13); }
.button-primary:hover:not(:disabled) { background: linear-gradient(135deg, #3a5640, #20362a); }
.button-face { width: 100%; min-height: 54px; border-color: #cdbb97; background: linear-gradient(135deg, #f5f0e2, #e9eadb); color: #415842; }
.button-face:hover:not(:disabled) { border-color: #a8a16f; background: #eeeddf; }
.button-quiet { border-color: var(--line); background: #fff; color: #657064; }
.button-quiet:hover:not(:disabled) { border-color: #c4d0c1; background: #f7f8f2; }
.face-symbol { position: relative; width: 19px; height: 19px; border: 1.6px solid currentColor; border-radius: 50%; }
.face-symbol::after { position: absolute; right: 3px; bottom: -3px; width: 8px; height: 6px; border: 1.6px solid currentColor; border-top: 0; border-radius: 0 0 6px 6px; background: var(--green-soft); content: ""; }
.hint { min-height: 18px; margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.hint.is-error, .feedback.is-error { color: var(--error); }
.hint.is-success, .feedback.is-success { color: var(--green-dark); }
.divider { display: flex; align-items: center; gap: 12px; margin: 21px 0; color: #888d80; font-size: 11px; }
.divider::before, .divider::after { height: 1px; flex: 1; background: #e8e8df; content: ""; }
.form-stack { display: grid; gap: 15px; }
.field { display: grid; gap: 7px; color: #49574b; font-size: 12px; font-weight: 700; }
.field input { width: 100%; min-height: 45px; padding: 0 13px; border: 1px solid #dfe2d8; border-radius: 9px; outline: none; background: #fff; color: var(--ink); font-size: 13px; font-weight: 500; }
.field input[type="file"] { min-height: 54px; padding: 6px 8px; border: 1px dashed #c4b58f; background: #fffdf8; cursor: pointer; }
.field input[type="file"]::file-selector-button { min-height: 40px; margin-right: 12px; padding: 0 15px; border: 1px solid #263d30; border-radius: 8px; background: linear-gradient(135deg, #486249, #293e31); color: #fffaf0; font: 700 12px "Segoe UI", Arial, sans-serif; cursor: pointer; transition: background .15s ease, transform .15s ease; }
.field input[type="file"]::file-selector-button:hover { background: linear-gradient(135deg, #3a5640, #20362a); transform: translateY(-1px); }
.field input[type="file"]:focus-visible { border-color: #8a9c70; box-shadow: 0 0 0 3px rgba(73, 100, 73, .13); }
.field input:focus, .field select:focus { border-color: #8a9c70; box-shadow: 0 0 0 3px rgba(73, 100, 73, .13); }
.field select { width: 100%; min-height: 45px; padding: 0 13px; border: 1px solid #dfe2d8; border-radius: 9px; outline: none; background: #fff; color: var(--ink); font-size: 13px; font-weight: 500; }
.password-control { position: relative; display: block; }
.password-control input { padding-right: 48px; }
.password-toggle { position: absolute; top: 50%; right: 8px; width: 34px; height: 34px; display: grid; place-items: center; padding: 0; transform: translateY(-50%); border: 0; border-radius: 8px; background: transparent; color: #76755f; }
.password-toggle:hover { background: #eee9da; color: var(--green-dark); }
.password-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.password-toggle .eye-closed { display: none; }
.password-toggle.is-visible .eye-open { display: none; }
.password-toggle.is-visible .eye-closed { display: block; }
.form-stack > .button { width: 100%; margin-top: 2px; }
.feedback { min-height: 18px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.register-prompt { margin: 20px 0 0; color: var(--muted); text-align: center; font-size: 12px; }
.text-button { padding: 0; border: 0; background: none; color: var(--green); font-size: inherit; font-weight: 700; }
.text-button:hover { text-decoration: underline; }

.camera-panel { margin-top: 15px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: #fbfbf6; }
.camera-frame { position: relative; overflow: hidden; width: 100%; min-height: 210px; aspect-ratio: 4 / 3; border-radius: 12px; background: #18221d; }
.camera-frame video { display: block; width: 100%; height: 100%; min-height: 210px; object-fit: cover; transform: scaleX(-1); }
.face-guide { position: absolute; inset: 10% 31% 9%; border: 2px solid rgba(240, 228, 187, .96); border-radius: 44% 44% 40% 40%; box-shadow: 0 0 0 999px rgba(8, 16, 11, .24); pointer-events: none; }
.camera-status { min-height: 19px; margin: 10px 0; color: #667267; font-size: 12px; line-height: 1.5; }
.camera-status.is-error { color: var(--error); }
.camera-status.is-success { color: var(--green-dark); }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; }
.button-row .button { flex: 1; }

.register-dialog { position: fixed; width: min(540px, calc(100% - 28px)); max-height: min(90vh, 820px); overflow-y: auto; padding: 30px; border: 1px solid #e2e4d9; border-radius: 20px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 100px rgba(25, 36, 29, .3); }
.register-dialog::backdrop { background: rgba(25, 35, 29, .58); backdrop-filter: blur(3px); }
.dialog-close { position: absolute; top: 12px; right: 15px; width: 34px; height: 34px; border: 0; border-radius: 9px; background: #f1f2eb; color: #667064; font-size: 23px; line-height: 1; }
.register-step { padding-top: 6px; }
.warning-box { margin: 20px 0; padding: 15px 17px; border: 1px solid #dec99f; border-radius: 4px 12px 12px 4px; background: #f8f0dc; color: #6f654e; font-size: 12px; line-height: 1.55; }
.warning-box strong { color: #665331; }
.warning-box ul { display: grid; gap: 7px; margin: 10px 0 0; padding-left: 18px; }
.consent-row { display: flex; align-items: flex-start; gap: 10px; margin: 17px 0; color: #596559; font-size: 12px; line-height: 1.55; }
.consent-row input { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; accent-color: var(--green); }
.dialog-actions { margin-top: 18px; }
.capture-progress { display: grid; gap: 6px; margin-top: 12px; color: #657267; font-size: 11px; }
.capture-progress progress { width: 100%; height: 8px; accent-color: var(--terracotta); }
.pose-instruction { margin: 17px 0 0; padding: 11px 14px; border-left: 3px solid var(--gold); background: #f5eedc; color: #5f5b46; font-size: 13px; font-weight: 700; }
.register-step .camera-frame { margin-top: 18px; }
.register-step .camera-frame video { min-height: 260px; }
.register-page { min-height: calc(100vh - 148px); padding: 36px 0 60px; }
.register-heading { width: min(680px, 100%); margin: 0 auto 24px; }
.register-heading h1 { margin-bottom: 10px; font: 800 clamp(32px, 5vw, 46px)/1.1 "Segoe UI", Arial, sans-serif; letter-spacing: -1.5px; }
.register-heading > p:last-child { color: var(--muted); font-size: 14px; line-height: 1.6; }
.register-card { width: min(680px, 100%); margin: 0 auto 28px; padding: clamp(23px, 4vw, 34px); border: 1px solid var(--line); border-radius: 19px; background: var(--paper); box-shadow: var(--shadow); }
.register-card h2 { margin-bottom: 10px; font: 750 24px/1.2 "Segoe UI", Arial, sans-serif; letter-spacing: -.6px; }
.register-card > p:not(.eyebrow) { color: var(--muted); font-size: 13px; line-height: 1.6; }
.registration-camera { width: min(500px, 100%); margin-right: auto; margin-left: auto; }

.home-panel { min-height: calc(100vh - 148px); display: grid; place-items: center; padding: 30px 0 70px; }
.home-card { width: min(590px, 100%); }
.home-card h1 { font-size: clamp(32px, 5vw, 46px); }
.home-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }
.workspace { min-height: calc(100vh - 148px); padding: 48px 0 70px; }
.workspace h1 { margin-bottom: 12px; font: 800 clamp(34px, 5vw, 48px)/1.1 "Segoe UI", Arial, sans-serif; letter-spacing: -1.5px; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 36px; }
.module-card { min-height: 210px; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: 0 10px 30px rgba(39, 53, 45, .045); }
.module-index { display: inline-block; margin-bottom: 25px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .13em; }
.module-card h2 { margin: 0 0 8px; font: 700 18px/1.3 "Segoe UI", Arial, sans-serif; }
.module-card p { min-height: 58px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.module-status { display: inline-block; padding: 6px 9px; border-radius: 999px; background: #f4f0e5; color: #78623d; font-size: 10px; font-weight: 700; }
.analysis-panel, .yolo-panel { margin-top: 24px; padding: clamp(22px, 4vw, 32px); border: 1px solid #dbccb0; border-radius: 18px; background: linear-gradient(145deg, rgba(255, 252, 244, .98), rgba(250, 244, 229, .98)); box-shadow: var(--shadow); }
.yolo-panel-heading { max-width: 780px; margin-bottom: 22px; }
.yolo-panel-heading h2 { margin: 0 0 9px; font: 750 24px/1.2 "Segoe UI", Arial, sans-serif; letter-spacing: -.6px; }
.yolo-panel-heading > p:last-child { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.yolo-video-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: end; }
.yolo-video-form .analysis-note { grid-column: 1 / -1; }
.yolo-video-form > .button { min-width: 250px; min-height: 52px; padding: 0 22px; border-radius: 12px; font-size: 14px; box-shadow: 0 7px 16px rgba(41, 62, 49, .18); }
.yolo-video-form > .button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(41, 62, 49, .23); }
.yolo-video-form > .button:focus-visible { outline: 3px solid rgba(73, 100, 73, .28); outline-offset: 3px; }
.analysis-panel-heading { max-width: 780px; margin-bottom: 22px; }
.analysis-panel-heading h2 { margin: 0 0 9px; font: 750 24px/1.2 "Segoe UI", Arial, sans-serif; letter-spacing: -.6px; }
.analysis-panel-heading > p:last-child { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.analysis-form { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(240px, 1fr); gap: 14px; align-items: end; }
.analysis-form .analysis-note, .analysis-form > .button { grid-column: 1 / -1; }
.analysis-form > .button { justify-self: start; min-width: 210px; }
.analysis-note { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.analysis-consent { grid-column: 1 / -1; display: flex; align-items: flex-start; gap: 9px; color: #575747; font-size: 11px; line-height: 1.5; }
.analysis-consent input { flex: 0 0 auto; margin: 2px 0 0; accent-color: var(--green); }
.analysis-progress, .analysis-results { margin-top: 23px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .66); }
.analysis-results-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.analysis-progress h3, .analysis-results-heading h3 { margin: 0; font: 700 16px/1.3 "Segoe UI", Arial, sans-serif; }
.butters-progress { margin: 14px 0 19px; padding: 14px 15px 11px; border: 1px solid #e5dece; border-radius: 12px; background: #fffdf7; }
.butters-progress-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.butters-progress-heading p { margin: 0; color: #555545; font-size: 12px; font-weight: 700; }
#butters-progress-percent { color: var(--green-dark); font-size: 11px; font-weight: 800; }
.butters-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin: 17px 0 13px; padding: 0; list-style: none; }
.butters-steps li { position: relative; padding: 11px 4px 0; border-top: 2px solid #ded8ca; color: #8b887b; text-align: center; font-size: 10px; line-height: 1.35; }
.butters-steps li::before { position: absolute; top: -6px; left: calc(50% - 5px); width: 8px; height: 8px; border: 2px solid #c7beaa; border-radius: 50%; background: #fffdf7; content: ""; }
.butters-steps li.is-done { border-color: var(--green); color: var(--green-dark); font-weight: 700; }
.butters-steps li.is-done::before { border-color: var(--green); background: var(--green); }
.butters-steps li.is-current { border-color: var(--terracotta); color: #754b35; font-weight: 800; }
.butters-steps li.is-current::before { border-color: var(--terracotta); background: #fff5e5; box-shadow: 0 0 0 3px rgba(173, 105, 75, .15); }
.butters-progress progress { display: block; width: 100%; height: 8px; accent-color: var(--green); }
.butters-progress progress:indeterminate { accent-color: var(--gold); }
.butters-video-card { width: 100%; margin: 0; }
.butters-video-caption { margin-bottom: 10px; color: var(--green-dark); font-size: 14px; font-weight: 750; }
.butters-video-frame { width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid #d7c7aa; border-radius: 13px; background: #1f2c25; box-shadow: 0 8px 20px rgba(39, 53, 45, .12); }
.butters-video-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.yolo-progress, .yolo-results { margin-top: 23px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .66); }
.yolo-progress h3, .yolo-results h3 { margin: 0; font: 700 16px/1.3 "Segoe UI", Arial, sans-serif; }
.yolo-progress > p { margin: 13px 0 8px; color: #555545; font-size: 12px; font-weight: 700; }
.yolo-progress progress { display: block; width: 100%; height: 9px; accent-color: var(--green); }
.yolo-results-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.yolo-results-heading .eyebrow { margin-bottom: 5px; }
.yolo-results-summary { color: var(--muted); font-size: 12px; line-height: 1.5; }
#yolo-output-video { display: block; width: 100%; max-height: 72vh; margin: 14px 0; border-radius: 12px; background: #1f2c25; object-fit: contain; }
.yolo-results h4 { margin: 15px 0 8px; font-size: 13px; }
.yolo-class-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 7px; margin: 0 0 14px; padding: 0; list-style: none; }
.yolo-class-counts li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 11px; border: 1px solid #e5dece; border-radius: 9px; color: #565747; font-size: 11px; }
.yolo-class-counts strong { color: var(--green-dark); font-weight: 800; }
.analysis-results-heading .eyebrow { margin-bottom: 5px; }
.analysis-total, .analysis-retention { color: var(--muted); font-size: 12px; line-height: 1.5; }
.analysis-total { margin: 16px 0 12px; }
.analysis-retention { margin: 0; font-size: 10px; }
.page-footer { padding: 17px 0 25px; border-top: 1px solid #e2e4d9; color: #82877a; text-align: center; font-size: 11px; }

@media (max-width: 820px) {
  .auth-layout { grid-template-columns: 1fr; gap: 30px; padding: 30px 0 55px; }
  .intro-panel { max-width: 620px; }
  .intro-panel h1 { font-size: clamp(34px, 9vw, 48px); }
  .privacy-note { margin-top: 25px; }
  .auth-card { width: min(500px, 100%); justify-self: center; }
  .module-grid { grid-template-columns: 1fr; }
  .analysis-form { grid-template-columns: 1fr; }
  .analysis-form .analysis-note, .analysis-form .analysis-consent, .analysis-form > .button { grid-column: auto; }
  .analysis-form > .button { width: 100%; }
  .yolo-video-form { grid-template-columns: 1fr; }
  .yolo-video-form .analysis-note { grid-column: auto; }
  .yolo-video-form > .button { width: 100%; }
}
@media (max-width: 480px) {
  .page-shell { width: min(100% - 26px, 1120px); }
  .brand-header { height: 70px; }
  .prototype-label { font-size: 9px; }
  .auth-card, .home-card { padding: 23px 19px; border-radius: 17px; }
  .register-dialog { padding: 25px 20px; }
  .button-row { display: grid; grid-template-columns: 1fr; }
  .button-row .button { width: 100%; }
  .analysis-progress, .analysis-results, .yolo-progress, .yolo-results { padding: 16px 13px; }
  .yolo-results-heading { align-items: stretch; flex-direction: column; }
  .butters-steps { gap: 2px; }
  .butters-steps li { font-size: 9px; }
  .analysis-results-heading { align-items: stretch; flex-direction: column; }
}
