:root{
  --cream:#FDFBF6;--olive:#5F6551;--olive-dark:#344239;--rose:#C75F78;
  --rose-soft:#F8E8EC;--muted:#747A76;--line:#E5DED5;--card:#FFFFFF;
  --shadow:0 6px 22px rgba(67,59,49,.07);
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--cream);color:var(--olive-dark);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
body{min-height:100vh}button,label{font:inherit}
.app-shell{max-width:680px;margin:0 auto;min-height:100vh;background:var(--cream)}
.screen{display:none;padding:18px 18px 110px}.screen.active{display:block}
.topbar{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:12px;padding:8px 0 12px}
.brand{font-family:Georgia,serif;font-size:30px;color:#2D3E35;text-align:center;white-space:nowrap}
.brand-mark{font-size:28px;color:var(--rose);text-align:right}.menu{text-align:right;font-size:28px;color:#32463C}
.back-btn{background:transparent;border:0;color:#32463C;font-size:20px;text-align:left;padding:0}
.hero{text-align:center;padding:18px 4px 14px}.hero.compact{padding-top:10px}
.hero h1{font-family:Georgia,serif;font-weight:500;font-size:40px;line-height:1.05;margin:0 0 10px;color:#243B34}
.hero p{margin:0;color:var(--muted);font-size:18px;line-height:1.45}
.choice-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin:14px 0}input[type=file]{display:none}
.choice-card{background:#F5F1E9;border:1px solid var(--line);border-radius:24px;min-height:160px;padding:22px 14px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:9px;cursor:pointer}
.choice-card strong{font-family:Georgia,serif;font-size:23px;font-weight:500}
.choice-card small{color:var(--muted);font-size:14px;line-height:1.35}.choice-icon{font-size:28px;color:var(--rose)}
.tip-card,.your-color-card{background:#fff;border:1px solid var(--line);border-radius:22px;padding:18px;display:flex;gap:14px;align-items:flex-start;box-shadow:var(--shadow)}
.tip-card h3,.your-color-card h2{font-family:Georgia,serif;margin:0 0 6px;font-weight:500;color:#344239}
.tip-card p,.your-color-card p{margin:0;color:var(--muted);line-height:1.45}.tip-icon,.target-icon{font-size:28px;color:var(--rose)}
.preview-card{margin-top:16px;background:#fff;border:1px solid var(--line);border-radius:22px;padding:12px;box-shadow:var(--shadow)}
.preview-card img{display:block;width:100%;height:auto;border-radius:16px;max-height:520px;object-fit:contain;background:#F0ECE4}.hidden{display:none!important}
.primary-btn,.secondary-btn{width:100%;border:0;border-radius:20px;padding:16px 18px;font-size:18px;font-weight:700;margin-top:16px}
.primary-btn{background:var(--rose);color:#fff}.primary-btn:disabled{opacity:.35}.secondary-btn{background:#EEE9E1;color:#405047}
.selection-card{background:#fff;border:1px solid var(--line);border-radius:22px;padding:12px;box-shadow:var(--shadow)}
.canvas-wrap{position:relative;width:100%;overflow:hidden;border-radius:18px;background:#EEEAE2;touch-action:none}
#photoCanvas{display:block;width:100%;height:auto}
.crosshair{position:absolute;width:34px;height:34px;transform:translate(-50%,-50%);pointer-events:none}
.crosshair .h-line,.crosshair .v-line,.crosshair .dot{position:absolute;background:white;box-shadow:0 0 0 1px rgba(60,50,50,.55)}
.crosshair .h-line{left:0;right:0;top:16px;height:2px}.crosshair .v-line{top:0;bottom:0;left:16px;width:2px}
.crosshair .dot{width:6px;height:6px;border-radius:50%;left:14px;top:14px;background:var(--rose);box-shadow:0 0 0 2px white}
.magnifier{position:absolute;right:12px;top:12px;border-radius:60px;border:4px solid white;box-shadow:0 2px 14px rgba(0,0,0,.22);background:#fff;pointer-events:none}
.selection-help{display:flex;justify-content:space-between;gap:14px;padding:12px 4px 0;color:var(--muted);font-size:14px}.selection-help strong{color:var(--olive-dark)}
.result-top{display:grid;grid-template-columns:1fr 1fr;gap:14px;align-items:start}
.selected-thumb,.best-card{background:#fff;border:1px solid var(--line);border-radius:22px;padding:12px;text-align:center;box-shadow:var(--shadow)}
.selected-thumb canvas{width:100%;height:auto;border-radius:15px;display:block}.selected-thumb span{display:block;font-family:Georgia,serif;font-size:20px;margin-top:8px}
.big-swatch{height:180px;border-radius:16px;border:1px solid var(--line)}.best-number{font-family:Georgia,serif;font-size:23px;margin-top:12px}
.best-name{font-size:19px;color:var(--muted);margin-top:5px}.your-color-card{margin-top:16px}.matches-section{margin-top:26px}
.matches-section h2{font-family:Georgia,serif;font-weight:500;font-size:31px;margin:0 0 5px;color:#344239}.matches-section>p{margin:0 0 12px;color:var(--muted)}
.matches-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.match-card{background:#fff;border:1px solid var(--line);border-radius:18px;padding:10px;text-align:center;min-height:230px;box-shadow:var(--shadow)}
.match-rank{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.rank-badge{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;background:var(--rose);color:white;font-weight:700}
.percent-badge{background:var(--rose-soft);color:#69434D;border-radius:14px;padding:4px 8px;font-size:13px;font-weight:700}
.match-swatch{height:100px;border-radius:14px;border:1px solid var(--line);margin-bottom:10px}.match-number{font-weight:800;font-size:14px}
.match-name{font-family:Georgia,serif;font-size:17px;margin-top:4px}.match-empty{display:flex;align-items:center;justify-content:center;color:#AAA;line-height:1.4}
.bottom-nav{position:fixed;left:50%;bottom:0;transform:translateX(-50%);width:min(680px,100%);background:rgba(253,251,246,.96);backdrop-filter:blur(8px);border-top:1px solid var(--line);display:grid;grid-template-columns:repeat(4,1fr);padding:10px 8px calc(10px + env(safe-area-inset-bottom));z-index:10}
.bottom-nav span{text-align:center;font-size:24px;color:#405047}.bottom-nav small{display:block;font-size:12px;margin-top:2px;color:#68716B}
@media(max-width:520px){.hero h1{font-size:34px}.choice-grid{grid-template-columns:1fr}.matches-grid{grid-template-columns:1fr}.result-top{grid-template-columns:1fr}.brand{font-size:26px}}
