:root {
  --ivory: #FAF6EF;
  --paper: #FFFFFF;
  --ink: #211E1A;
  --muted: #7A7264;
  --line: #E3DACB;
  --brass: #9C7C4D;
  --danger: #A5493A;
  --maxw: 1080px;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body.app {
  font-family: var(--sans);
  background: var(--ivory);
  color: var(--ink);
  line-height: 1.65;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
em { font-style: italic; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.brand { font-family: var(--serif); font-weight: 600; font-size: 24px; letter-spacing: .5px; color: var(--ink); }
.brand span { color: var(--brass); font-style: italic; }

.kicker { font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: var(--brass); margin-bottom: 18px; }

.btn {
  display: inline-block; font-family: var(--sans); font-size: 12.5px; font-weight: 500;
  letter-spacing: 1.5px; text-transform: uppercase; padding: 14px 28px;
  border: 1px solid transparent; cursor: pointer; transition: all .25s;
}
.btn--solid { background: var(--ink); color: var(--ivory); border-radius: 0; }
.btn--solid:hover { background: var(--brass); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.link-arrow { background: none; border: none; border-bottom: 1px solid var(--ink); padding: 0 0 2px; font-family: var(--sans); font-size: 13px; letter-spacing: .5px; color: var(--ink); cursor: pointer; transition: color .25s, border-color .25s; }
.link-arrow:hover { color: var(--brass); border-color: var(--brass); }
.link-arrow--danger { color: var(--danger); border-color: var(--danger); }
.link-arrow--danger:hover { color: var(--danger); border-color: var(--danger); }

/* APP NAV */
.appnav { border-bottom: 1px solid var(--line); background: rgba(250,246,239,.9); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 40; }
.appnav__inner { max-width: var(--maxw); margin: 0 auto; padding: 16px 32px; display: flex; align-items: center; gap: 18px; }
.appnav__tag { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); border-left: 1px solid var(--line); padding-left: 18px; }
.appnav__right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.credits { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--brass); border: 1px solid var(--line); border-radius: 30px; padding: 5px 12px; background: var(--paper); }
.appnav__user { font-size: 13px; color: var(--muted); }
.appnav__signout { background: none; border: none; font-family: var(--sans); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); cursor: pointer; }
.appnav__signout:hover { color: var(--ink); }

.appmain { flex: 1; width: 100%; }

/* AUTH */
.auth { display: flex; justify-content: center; padding: 90px 24px; }
.auth__card { max-width: 440px; width: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 48px 42px; box-shadow: 0 24px 56px -32px rgba(33,30,26,.3); }
.auth__card h1 { font-family: var(--serif); font-size: 38px; font-weight: 500; line-height: 1.1; margin-bottom: 14px; }
.auth__sub { font-size: 15px; color: var(--muted); margin-bottom: 30px; }
#authForm { display: flex; flex-direction: column; gap: 14px; }
#authForm input { width: 100%; padding: 14px 15px; font-family: var(--sans); font-size: 15px; font-weight: 300; border: 1px solid var(--line); background: var(--ivory); color: var(--ink); border-radius: 0; }
#authForm input:focus { outline: none; border-color: var(--brass); }
.auth__status { margin-top: 16px; font-size: 14px; color: var(--brass); }
.auth__fine { margin-top: 26px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 18px; }

/* WORKSPACE */
.workspace { max-width: var(--maxw); margin: 0 auto; padding: 44px 32px 90px; }
.demo-note { font-size: 12.5px; color: var(--muted); background: var(--paper); border: 1px solid var(--line); border-left: 2px solid var(--brass); padding: 12px 16px; margin-bottom: 30px; }

.ws-grid { display: grid; grid-template-columns: 1fr 300px; gap: 30px; align-items: start; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 36px; }
.panel h2 { font-family: var(--serif); font-size: 32px; font-weight: 500; margin-bottom: 26px; line-height: 1.1; }
.panel h3 { font-family: var(--serif); font-size: 22px; font-weight: 500; margin-bottom: 16px; }
.panel--side { padding: 26px; }
.side-note { font-size: 13.5px; color: var(--muted); margin-bottom: 16px; }

.field { display: block; margin-bottom: 20px; }
.field > span { display: block; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.field > span em { text-transform: none; letter-spacing: 0; }
.field input { width: 100%; padding: 12px 14px; font-family: var(--sans); font-size: 15px; font-weight: 300; border: 1px solid var(--line); background: var(--ivory); color: var(--ink); border-radius: 0; }
.field input:focus { outline: none; border-color: var(--brass); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* DROPZONE */
.drop { border: 1px dashed var(--line); border-radius: 10px; background: var(--ivory); padding: 34px 20px; text-align: center; cursor: pointer; transition: border-color .25s, background .25s; }
.drop:hover, .drop.is-over { border-color: var(--brass); background: #FDFBF7; }
.drop__title { font-family: var(--serif); font-size: 19px; font-weight: 500; margin-bottom: 6px; }
.drop__sub { font-size: 12.5px; color: var(--muted); }
.drop.has-error { border-color: var(--danger); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; margin-top: 16px; }
.thumb { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--ivory); }
.thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.thumb__name { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(33,30,26,.72); color: var(--ivory); font-size: 10.5px; letter-spacing: .5px; padding: 4px 7px; display: flex; justify-content: space-between; }
.thumb__rm { cursor: pointer; color: #E8C9B8; background: none; border: none; font-size: 12px; line-height: 1; }
.hint { margin-top: 14px; font-size: 13px; color: var(--muted); }
.hint--error { color: var(--danger); }

/* RUNNING */
.running__sub { font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.runlog { font-size: 13.5px; color: var(--muted); display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; min-height: 120px; }
.runlog span { display: block; }
.runlog span.pending { opacity: .35; }
.runlog span.done::before { content: "— "; color: var(--brass); }
.runlog span.active { color: var(--ink); }
.runlog span.active::before { content: "· "; color: var(--brass); }
.progress { height: 4px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--brass); transition: width .6s ease; }

/* RESULTS */
.results__kicker { font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: var(--brass); margin-bottom: 10px; }
.results { margin: 6px 0 30px; }
.res { display: grid; grid-template-columns: 44px 64px 1fr; gap: 16px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.res__rank { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--ink); color: var(--ivory); font-family: var(--serif); font-size: 18px; }
.res--1 .res__rank { background: var(--brass); }
.res__tile { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: linear-gradient(135deg,#E9DFCE,#D8C7A8); display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 22px; }
.res__tile img { width: 100%; height: 100%; object-fit: cover; }
.res__name { font-family: var(--serif); font-size: 20px; font-weight: 500; margin-bottom: 8px; }
.res__bar { display: block; height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; }
.res__bar i { display: block; height: 100%; background: var(--brass); }
.res__score { float: right; font-size: 12px; color: var(--muted); margin-left: 12px; }

/* DEEP DIVE */
.deepdive { position: relative; border-top: 1px solid var(--line); padding-top: 28px; margin-bottom: 30px; }
.deepdive__content h3 { font-family: var(--serif); font-size: 24px; font-weight: 500; margin-bottom: 12px; }
.deepdive__content > p { font-size: 15px; color: var(--muted); max-width: 560px; }
.deepdive__dims { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-top: 24px; }
.dim { background: var(--ivory); border: 1px solid var(--line); border-radius: 8px; padding: 14px 12px; }
.dim__name { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.dim__val { font-family: var(--serif); font-size: 26px; font-weight: 500; color: var(--ink); }
.deepdive.is-locked .deepdive__content { filter: blur(7px); user-select: none; pointer-events: none; }
.deepdive__lock { position: absolute; inset: 28px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.deepdive__locktitle { font-family: var(--serif); font-size: 24px; font-weight: 500; }
.deepdive__locksub { font-size: 13.5px; color: var(--muted); margin-bottom: 12px; max-width: 340px; }
#newTestAgain { margin-top: 4px; }

/* HISTORY */
.history { list-style: none; }
.history li { font-size: 13.5px; padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; }
.history li:last-child { border-bottom: none; }
.history__empty { color: var(--muted); }
.history__name { font-family: var(--serif); font-size: 16px; }
.history__win { color: var(--brass); font-size: 12px; }

/* MODAL */
.modal { position: fixed; inset: 0; background: rgba(33,30,26,.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px; }
.modal__card { position: relative; background: var(--ivory); border-radius: 14px; padding: 44px 42px; max-width: 760px; width: 100%; max-height: 90vh; overflow: auto; box-shadow: 0 40px 90px -30px rgba(0,0,0,.5); }
.modal__card h2 { font-family: var(--serif); font-size: 36px; font-weight: 500; margin-bottom: 28px; }
.modal__close { position: absolute; top: 16px; right: 20px; background: none; border: none; font-size: 28px; color: var(--muted); cursor: pointer; line-height: 1; }
.billing__opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.bill-opt { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 22px 20px; display: flex; flex-direction: column; gap: 10px; }
.bill-opt--featured { border-color: var(--brass); }
.bill-opt__head { display: flex; justify-content: space-between; align-items: baseline; }
.bill-opt__name { font-family: var(--serif); font-size: 21px; font-weight: 500; }
.bill-opt__price { font-family: var(--serif); font-size: 26px; font-weight: 500; color: var(--brass); }
.bill-opt__price span { font-family: var(--sans); font-size: 11px; color: var(--muted); font-weight: 300; }
.bill-opt__sub { font-size: 12.5px; color: var(--muted); flex: 1; }
.bill-opt .btn { text-align: center; padding: 12px 10px; font-size: 11.5px; }
.billing__note { font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 18px; }
.billing__note a { color: var(--ink); border-bottom: 1px solid var(--brass); }

/* FOOTER */
.appfooter { border-top: 1px solid var(--line); padding: 26px 32px; }
.appfooter p { max-width: var(--maxw); margin: 0 auto; font-size: 12px; color: var(--muted); }

/* RESPONSIVE */
@media (max-width: 900px) {
  .ws-grid { grid-template-columns: 1fr; }
  .billing__opts { grid-template-columns: 1fr; }
  .deepdive__dims { grid-template-columns: repeat(2, 1fr); }
  .panel { padding: 26px 22px; }
  .appnav__user { display: none; }
  .field-row { grid-template-columns: 1fr; }
}
