/* Floor Plan Area Tool. Colours and fonts are the website's (Website/css/site.css). The shapes
   follow Matt's house rule: one corner radius on everything, a rectangle with a slight curve. */
@font-face { font-family: 'Unbounded'; src: url('../assets/unbounded-latin.woff2') format('woff2'); font-weight: 500 700; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('../assets/manrope-latin.woff2') format('woff2'); font-weight: 500 800; font-display: swap; }

:root {
  --ground: #050506;
  --panel: #0e0e11;
  --soft: #c6c6ce;
  --line: rgba(255, 255, 255, 0.18);
  --radius: 10px;
  --head: 'Unbounded', sans-serif;
  --body: 'Manrope', system-ui, sans-serif;
  --zone: #30d158;
  --exclude: #ff453a;
  --top: 64px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: var(--ground); color: #fff; font: 500 16px/1.5 var(--body); }
h1, h2, p, ol { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Glass, for the things that float over the plan. */
.toolbar, .scale-box, .hint, dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(24, 24, 27, 0.9) 0%, rgba(5, 5, 6, 0.9) 100%);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 24px 48px rgba(0, 0, 0, 0.45);
}

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: var(--radius); background: rgba(255, 255, 255, 0.08); font-weight: 800; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer; transition: background 0.2s ease, border-color 0.2s ease; }
.btn:hover { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.6); }
.btn-main { border-color: #fff; background: #fff; color: #050506; }
.btn-main:hover { border-color: #e7e7ea; background: #e7e7ea; }
.label { font-weight: 800; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--soft); }
.small { margin-top: 16px; font-size: 14px; color: var(--soft); }

.top { display: flex; align-items: center; gap: 16px; height: calc(var(--top) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 20px 0; border-bottom: 1px solid var(--line); }
.brand img { display: block; }
#side-open { display: none; }
.top-title { margin-right: auto; font: 600 15px/1 var(--head); letter-spacing: -0.01em; }

.layout { display: flex; height: calc(100% - var(--top) - env(safe-area-inset-top)); }
.stage { position: relative; flex: 1; min-width: 0; overflow: hidden; background: #101013; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.stage.drop { outline: 2px dashed #fff; outline-offset: -10px; }
canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.stage.drawing canvas { cursor: crosshair; }
.stage.grab canvas { cursor: grab; }

.intro { position: absolute; inset: 0; overflow-y: auto; padding: 48px 32px; background: var(--ground); touch-action: pan-y; user-select: text; -webkit-user-select: text; }
.intro > * { max-width: 640px; margin-left: auto; margin-right: auto; }
.intro h1 { margin-top: 16px; font: 600 clamp(26px, 3.1vw, 40px)/1.14 var(--head); letter-spacing: -0.01em; text-wrap: balance; }
.intro .lead { margin-top: 18px; font-size: 18px; color: #e7e7ea; text-wrap: pretty; }
.intro .btn-main { display: flex; width: max-content; margin-top: 28px; min-height: 52px; padding: 0 28px; font-size: 14px; }
.intro .note { margin-top: 12px; font-size: 14px; color: var(--soft); }
.promise { margin-top: 28px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.04) 100%); text-wrap: pretty; }
/* Each step is a number badge beside its text, both starting on the same line. */
.steps { margin-top: 28px; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; min-height: 28px; margin-top: 14px; padding-left: 42px; color: var(--soft); counter-increment: step; text-wrap: pretty; }
.steps li strong { color: #fff; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: -2px; display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 8px; font: 800 14px/1 var(--body); color: #fff; }

.hint { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 28px); padding: 8px 16px; font-size: 14px; text-align: center; text-wrap: balance; pointer-events: none; }
.hint.warn { border-color: var(--exclude); }

.toolbar { position: absolute; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; width: max-content; max-width: calc(100% - 20px); padding: 6px; border-radius: 14px; }
.toolbar .group { display: flex; gap: 6px; }
.toolbar button { min-width: 44px; min-height: 44px; padding: 0 14px; border: 1px solid transparent; border-radius: var(--radius); background: rgba(255, 255, 255, 0.08); font-weight: 800; font-size: 13px; cursor: pointer; white-space: nowrap; }
.toolbar button:disabled { opacity: 0.4; cursor: default; }
.toolbar button:hover { background: rgba(255, 255, 255, 0.16); }
.toolbar button[aria-pressed="true"] { background: #fff; color: #050506; }
.toolbar #finish { background: var(--zone); color: #050506; }
.toolbar #zoom-in, .toolbar #zoom-out { padding: 0; font-size: 20px; }

.scale-box, dialog { padding: 20px; color: #fff; }
.scale-box { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); width: min(340px, calc(100% - 28px)); user-select: text; -webkit-user-select: text; }
.scale-box label, dialog h2 { display: block; font: 600 16px/1.3 var(--head); text-wrap: balance; }
.scale-row { display: flex; gap: 8px; margin-top: 14px; }
.scale-row .btn { flex: 1; }
.scale-row input, .scale-row select { flex: 1; min-width: 0; min-height: 44px; padding: 0 14px; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: var(--radius); background-color: rgba(255, 255, 255, 0.06); font-size: 16px; font-weight: 800; }
/* The browser's own number arrows and dropdown arrow are replaced: no arrows on the number,
   and one drawn chevron on the dropdown with room around it. */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.scale-row select { flex: 0 0 132px; -webkit-appearance: none; appearance: none; padding-right: 40px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 16px; }
select option { color: #050506; }

/* The results panel is a plain solid surface: text over blurred glass looked soft. */
.side { width: 360px; flex: none; overflow-y: auto; overscroll-behavior: contain; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); border-left: 1px solid var(--line); background: var(--panel); }
#side-close { display: none; }
.total-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.side .flip { min-height: 32px; padding: 0 12px; font-size: 12px; letter-spacing: 0.02em; text-transform: none; }
.total-number { margin-top: 10px; font: 700 44px/1 var(--head); letter-spacing: -0.02em; }
.total-number span { font-size: 20px; font-weight: 600; }
.total-feet { margin-top: 8px; font-size: 18px; font-weight: 600; color: var(--soft); }
.warn-text { margin-top: 10px; font-size: 14px; font-weight: 600; color: #ffb4ae; }
.block { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 8px; min-height: 52px; margin-top: 8px; padding: 6px 6px 6px 12px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: var(--radius); background: rgba(255, 255, 255, 0.06); cursor: pointer; }
.row.active { border-color: rgba(255, 255, 255, 0.7); background: rgba(255, 255, 255, 0.12); }
.row input { flex: 1; min-width: 0; min-height: 36px; padding: 0 6px; border: 1px solid transparent; border-radius: 6px; background: transparent; font-weight: 800; font-size: 15px; text-overflow: ellipsis; }
.row input:hover, .row input:focus { border-color: rgba(255, 255, 255, 0.3); }
.row .area { flex: none; font-size: 13px; font-weight: 600; text-align: right; color: var(--soft); line-height: 1.35; }
.row .area b { display: block; color: #fff; font-size: 15px; font-weight: 800; }
.row .x { flex: none; width: 36px; height: 36px; border: 0; border-radius: 6px; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; color: var(--soft); }
.row .x:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--zone); }
.dot.exclude { background: var(--exclude); }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.buttons .btn { flex: 1 1 auto; padding: 0 14px; font-size: 12px; }
.empty { margin-top: 10px; font-size: 14px; font-weight: 600; color: var(--soft); }

dialog { width: min(560px, calc(100% - 28px)); max-height: calc(100% - 28px); overflow-y: auto; }
dialog::backdrop { background: rgba(0, 0, 0, 0.7); }
.page-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 16px; }
.page-list label { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; font-weight: 800; cursor: pointer; }
.page-list label:has(input:checked) { border-color: #fff; background: rgba(255, 255, 255, 0.12); }
.page-list canvas { width: 100%; height: 100px; object-fit: contain; background: #fff; border-radius: 6px; cursor: pointer; }

/* Phones: the page never scrolls, so a finger on the plan only ever draws or moves the plan
   (the same fix as Ninja Flight and Rogue Hunt). The results open over the plan instead. */
@media (max-width: 819px) {
  :root { --top: 52px; }
  body { position: fixed; inset: 0; overscroll-behavior: none; }
  .brand img { width: 105px; height: 32px; }
  .top { gap: 10px; padding-left: 14px; padding-right: 14px; }
  .top-title { display: none; }
  .brand { margin-right: auto; }
  #side-open { display: inline-flex; min-height: 38px; padding: 0 14px; letter-spacing: 0.04em; }
  .side { display: none; position: fixed; inset: 0; z-index: 5; width: auto; border: 0; padding-top: calc(20px + env(safe-area-inset-top)); }
  .side.open { display: block; }
  #side-close { display: flex; margin-bottom: 20px; }
  .intro { padding: 28px 20px 40px; }
  .intro .lead { font-size: 16px; }
  .toolbar { gap: 6px; }
  .toolbar button { padding: 0 11px; font-size: 12px; }
  .hint { font-size: 13px; }
}
