* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

/* HomeShuffle — peach & mint: warm cream, coral, fresh green. Light is the default. */
:root {
  --bg: #FFF7F1;
  --surface: #FFFFFF;
  --surface2: #F7EBE0;
  --border: #EFDECF;
  --hairline: rgba(70, 55, 42, .08);
  --text: #2E2620;
  --muted: #8A7565;
  --accent: #D9542F;      /* deep coral — text/links on light */
  --accent-soft: #FF7E5F; /* coral fills */
  --clay: #C77E4A;        /* warm secondary — shop links */
  --mint: #2E8A63;        /* fresh mint-green — success, costs, scores */
  --amber: #C06B15;
  --rose: #CE4B44;
  --glass: rgba(255, 247, 241, .85);
  --grad: linear-gradient(135deg, #FF8A66 0%, #F25C3E 100%);
}

/* night mode — warm charcoal with the coral glowing; light stays the default */
:root.dark {
  --bg: #221B19;
  --surface: #2B2320;
  --surface2: #362C28;
  --border: #473A34;
  --hairline: rgba(255, 255, 255, .06);
  --text: #F5EFE9;
  --muted: #B3A296;
  --accent: #FF9B7E;
  --accent-soft: #FF7E5F;
  --clay: #D9A16C;
  --mint: #6FD3A6;
  --amber: #E8B268;
  --rose: #EF8B7F;
  --glass: rgba(34, 27, 25, .82);
}

html, body { height: 100%; }
html { background: var(--bg); }   /* paints rotation/safe-area gaps in the theme color */
body {
  font-family: -apple-system, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  overflow: hidden;
  display: flex; flex-direction: column;
}
/* the app scrolls inside its own container: in the iOS webview this gives
   native momentum + rubber-band at the ends instead of a hard stop */
#scroller {
  flex: 1; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 48px);
}

/* ---------------------------------------------------------------- header */
header {
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 18px 14px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
#logo { width: 42px; height: 42px; border-radius: 11px; }
/* two-tone wordmark: "Home" in ink, "Shuffle" carries the coral gradient */
header h1 {
  font-size: 22px; line-height: 1.05; letter-spacing: -0.02em; font-weight: 800;
  color: var(--text);
}
header h1 .wm-view {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.by { color: var(--muted); font-size: 12.5px; letter-spacing: .02em; }
#backBtn {
  margin-left: auto; font: inherit; font-size: 15px; font-weight: 600;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); padding: 9px 16px;
}

main { padding: 20px 18px; max-width: 640px; margin: 0 auto; }
.hidden { display: none !important; }
.hint { color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.center { text-align: center; margin-top: 30px; }

/* --------------------------------------------------------------- buttons */
button, .snap-btn { font: inherit; cursor: pointer; }
.primary {
  background: var(--grad); color: #fff; font-weight: 700;
  border: none; border-radius: 16px;
  box-shadow: 0 6px 22px rgba(226, 85, 47, .25);
}
.primary:active { transform: scale(.985); }
.big { width: 100%; padding: 17px; font-size: 18px; margin-bottom: 20px; letter-spacing: -0.01em; }

/* ------------------------------------------------------------- home list */
.prop-card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; margin-bottom: 12px;
  transition: border-color .15s;
  touch-action: pan-y;   /* horizontal drags are ours, vertical stays scrolling */
  -webkit-user-select: none; user-select: none;
}
.prop-card:active { border-color: var(--accent-soft); }
.prop-card .swipe-content {
  position: relative; z-index: 1; background: var(--surface);
  display: flex; align-items: center; gap: 12px; padding: 17px;
  transition: transform .18s ease-out;
}
.prop-card .swipe-actions {
  position: absolute; top: 0; right: 0; bottom: 0; display: flex;
}
.prop-card .swipe-actions button {
  font: inherit; font-size: 13px; font-weight: 700; border: none;
  width: 76px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 5px; color: var(--text);
  background: var(--surface2);
}
.prop-card .mini-del { background: rgba(206, 75, 68, .14); color: var(--rose); }
.prop-card .info { flex: 1; min-width: 0; }
.prop-card .addr {
  font-weight: 700; font-size: 17px; letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.prop-card .meta { color: var(--muted); font-size: 14px; margin-top: 3px; }
.prop-card .score {
  background: rgba(46, 138, 99, .12); color: var(--mint); font-weight: 800;
  border: 1px solid rgba(46, 138, 99, .35);
  border-radius: 12px; padding: 8px 13px; font-size: 16px;
}

/* -------------------------------------------------------------- home view */
#propView h2 { font-size: 21px; letter-spacing: -0.02em; margin-bottom: 16px; }
.snap-btn {
  display: block; text-align: center;
  background: var(--grad); color: #fff; font-weight: 700;
  border-radius: 16px; padding: 17px; font-size: 18px; margin-bottom: 10px;
  letter-spacing: -0.01em;
  box-shadow: 0 6px 22px rgba(226, 85, 47, .25);
}
.snap-btn:active { transform: scale(.985); }
.snap-btn.alt {
  background: var(--surface2); color: var(--text); font-weight: 600;
  border: 1px solid var(--border); box-shadow: none;
}

/* -------------------------------------------------------------- room card */
.room-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; overflow: hidden; margin-top: 16px;
}
.room-card .imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.room-card .imgs.single { grid-template-columns: 1fr; }
.room-card .imgs figure { position: relative; margin: 0; }
.room-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.room-card figcaption {
  position: absolute; bottom: 8px; left: 8px;
  background: rgba(46, 38, 32, .72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: #fff; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 20px;
}
.room-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; }
.room-head .rtype { font-weight: 800; font-size: 18px; letter-spacing: -0.02em; flex: 1; }
.score-pill { font-weight: 800; font-size: 14.5px; border-radius: 20px; padding: 5px 12px; }
.score-good { background: rgba(46, 138, 99, .12); color: var(--mint); border: 1px solid rgba(46, 138, 99, .35); }
.score-mid  { background: rgba(192, 107, 21, .1); color: var(--amber); border: 1px solid rgba(192, 107, 21, .3); }
.score-low  { background: rgba(206, 75, 68, .1); color: var(--rose); border: 1px solid rgba(206, 75, 68, .3); }
.room-status { padding: 16px; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.room-summary { padding: 8px 16px 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.issues { list-style: none; padding: 12px 16px 14px; }
.issues li {
  display: flex; gap: 10px; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--hairline);
  font-size: 16px; line-height: 1.45;
}
.issues li:last-child { border-bottom: none; }
.pri {
  font-size: 10.5px; font-weight: 800; letter-spacing: .04em;
  border-radius: 6px; padding: 2.5px 8px; white-space: nowrap;
}
.pri-high   { background: rgba(206, 75, 68, .12); color: var(--rose); }
.pri-medium { background: rgba(192, 107, 21, .1); color: var(--amber); }
.pri-low    { background: var(--surface2); color: var(--muted); }
.ready-note { padding: 12px 16px 16px; color: var(--mint); font-weight: 700; }
.room-actions { display: flex; gap: 8px; padding: 0 16px 16px; flex-wrap: wrap; }
.room-actions button {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  border-radius: 12px; padding: 9px 15px; font-size: 15px; font-weight: 600;
}

.style-btn, .restyle {
  background: rgba(255, 126, 95, .16) !important;
  border: 1px solid rgba(255, 126, 95, .55) !important;
  color: var(--accent) !important; font-weight: 700 !important;
}
.style-plan { border-top: 1px solid var(--border); margin-top: 4px; }
.style-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 0; font-weight: 800; font-size: 17px; letter-spacing: -0.01em;
  color: var(--accent);
}
.budget-pill {
  color: var(--mint);
  background: rgba(46, 138, 99, .1); border: 1px solid rgba(46, 138, 99, .35);
  font-size: 13.5px; font-weight: 800; border-radius: 20px; padding: 4px 12px;
}
.up-body { flex: 1; }
.up-cost { color: var(--mint); font-weight: 700; font-size: 14px; margin-left: 4px; }
.up-why { color: var(--muted); font-size: 14px; }
.shop-row { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.shop-chip {
  font-size: 12.5px; font-weight: 700; text-decoration: none;
  color: var(--clay); background: rgba(199, 126, 74, .1);
  border: 1px solid rgba(199, 126, 74, .4);
  border-radius: 20px; padding: 4px 11px;
}
.shop-chip:active { transform: scale(.96); }

.spinner {
  width: 18px; height: 18px; border: 3px solid var(--border);
  border-top-color: var(--accent-soft); border-radius: 50%;
  animation: spin .9s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.snap-btn .btn-spin {
  display: inline-block; width: 15px; height: 15px; border-width: 2px;
  margin-right: 9px; vertical-align: -2px; border-top-color: #fff;
}
.snap-btn.busy { opacity: .65; pointer-events: none; }

.room-note {
  margin: 12px 16px 0; padding: 12px 14px;
  background: rgba(255, 126, 95, .12); border: 1px solid rgba(255, 126, 95, .45);
  border-radius: 14px; font-size: 15.5px; display: flex; gap: 8px; line-height: 1.5;
}

/* ------------------------------------------------------ share + comments */
.share-btn {
  display: block; width: 100%; text-align: center;
  background: rgba(255, 126, 95, .16); color: var(--accent); font-weight: 700;
  border: 1px solid rgba(255, 126, 95, .55);
  border-radius: 16px; padding: 16px; font-size: 17px;
}
.share-btn:active { transform: scale(.985); }
.cmt-box { margin-top: 26px; }
.cmt-box h3 { font-size: 17px; letter-spacing: -0.01em; margin-bottom: 10px; }
.cmt {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 8px;
  display: flex; gap: 10px; align-items: baseline;
}
.cmt .who { font-weight: 700; font-size: 14px; color: var(--accent); white-space: nowrap; }
.cmt .txt { flex: 1; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.cmt .cmt-del {
  background: none; border: none; color: var(--muted);
  font-size: 14px; padding: 2px 4px; cursor: pointer;
}

.prop-actions { margin-top: 26px; display: flex; flex-direction: column; gap: 10px; }
.danger {
  background: none; border: 1px solid rgba(206, 75, 68, .4); color: var(--rose);
  border-radius: 14px; padding: 12px; font-weight: 600;
}

/* --------------------------------------------------------------- feedback */
.foot-btns { display: flex; gap: 10px; justify-content: center; margin-top: 26px; }
.copyright { text-align: center; color: var(--muted); opacity: .6; font-size: 12px; margin-top: 16px; }
.fb-btn {
  display: block;
  background: var(--surface2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 20px; padding: 11px 22px; font-size: 15px; font-weight: 600;
}
#fbModal {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(46, 38, 32, .55);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center; padding: 22px;
}
.fb-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 22px; padding: 24px; max-width: 440px; width: 100%;
}
.fb-card h2 { font-size: 21px; letter-spacing: -0.02em; margin-bottom: 6px; }
.fb-card textarea {
  width: 100%; min-height: 130px; resize: vertical; margin-top: 12px;
  font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 14px; padding: 13px;
}
.fb-card textarea:focus { outline: none; border-color: var(--accent-soft); }
.fb-actions { display: flex; gap: 10px; margin-top: 14px; }
.fb-actions button { flex: 1; font: inherit; border-radius: 14px; padding: 13px; font-weight: 700; }
#fbCancel, #styleCancel { background: var(--surface2); border: 1px solid var(--border); color: var(--text); }
.fb-note { min-height: 20px; margin-top: 10px; text-align: center; color: var(--mint); font-size: 14.5px; }

/* ---------------------------------------------------------- shuffle modal */
#styleModal {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(46, 38, 32, .55);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center; padding: 22px;
}
#styleModal .fb-card { max-height: 86dvh; overflow-y: auto; }
.chip-label {
  margin: 16px 0 0; font-size: 12.5px; font-weight: 800; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted);
}
.style-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.style-chips button {
  font: inherit; font-size: 14px; font-weight: 600; color: var(--text);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 20px; padding: 8px 14px; cursor: pointer;
}
.style-chips button.sel { border-color: var(--accent-soft); color: var(--accent); }
#styleModal textarea { min-height: 90px; }
.style-left { margin-top: 10px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------------------------------------------------------------- paywall */
#paywall {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(46, 38, 32, .6);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: center; padding: 22px;
}
.pw-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 24px; padding: 30px 26px calc(env(safe-area-inset-bottom, 0px) + 26px);
  max-width: 420px; width: 100%; text-align: center;
}
.pw-card img { width: 76px; height: 76px; border-radius: 18px; margin-bottom: 14px; }
.pw-card h2 { font-size: 26px; letter-spacing: -0.02em; font-weight: 800; }
.pw-pro {
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.pw-pitch { color: var(--muted); font-size: 15.5px; line-height: 1.55; margin: 12px 0 18px; }
.pw-price { font-size: 17px; margin-bottom: 18px; }
.pw-price strong { color: var(--mint); }
#pwSubscribe { margin-bottom: 4px; }
#pwRestore {
  background: none; border: none; color: var(--muted);
  font-size: 14.5px; font-weight: 600; padding: 12px; width: 100%;
}
.pw-msg { color: var(--amber); font-size: 14px; min-height: 18px; }
.pw-legal { color: var(--muted); font-size: 12px; line-height: 1.6; margin-top: 8px; }
.pw-legal a { color: var(--accent); }

/* --------------------------------------------------------------- lightbox */
#lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(26, 20, 16, .97);
  display: flex; align-items: center; justify-content: center;
  touch-action: none; cursor: zoom-out;
}
#lightbox img { max-width: 100vw; max-height: 100vh; object-fit: contain; }
.lb-label {
  position: fixed; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  left: 50%; transform: translateX(-50%);
  background: rgba(43, 35, 29, .85); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  color: #fff; font-size: 14.5px; font-weight: 600;
  padding: 8px 18px; border-radius: 22px; white-space: nowrap;
}
.room-card img, .imgs img { cursor: zoom-in; }
