:root {
  color-scheme: dark;
  --bg: #0c0a0d;
  --surface: #181318;
  --raised: #241b23;
  --line: #4b3745;
  --text: #fbf0f6;
  --muted: #c5aebb;
  --accent: #f4a0c9;
  --positive: #89e2b2;
  --notice: #ffca98;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(ellipse at 50% 0, #291723 0%, var(--bg) 61%);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

main {
  width: min(calc(100% - 44px), 960px);
  margin: 0 auto;
  padding: max(30px, env(safe-area-inset-top)) 0 max(30px, env(safe-area-inset-bottom));
}

.topbar, .brand { display: flex; align-items: center; gap: 13px; }
.topbar { justify-content: space-between; padding-bottom: 19px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.brand strong { display: block; font-size: 1.3rem; letter-spacing: -.035em; line-height: 1.15; }
.brand-accent { color: var(--accent); }
.brand-caption { display: block; color: var(--muted); font-size: .79rem; margin-top: 2px; }

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(145deg, #ffc1df, #e586bc);
  color: #291421;
  font-weight: 850;
  font-size: 1.4rem;
  padding-right: 4px;
}

.brand-mark span { position: absolute; right: 6px; top: 3px; font-size: .67rem; }
.demo { border: 1px solid #66475a; background: #352433; color: #ffd0e8; border-radius: 999px; padding: 4px 10px; font-size: .75rem; }

.workspace { display: grid; grid-template-columns: minmax(210px, 260px) minmax(0, 1fr); align-items: start; gap: 18px; }
.rental, .access, .payment-note, dialog { border: 1px solid var(--line); background: var(--surface); }
.rental { display: grid; gap: 14px; padding: 19px; border-radius: 20px; }
.rental-account, .rental-time { min-width: 0; }
.rental-time { padding-top: 12px; border-top: 1px solid var(--line); }
.label { display: block; color: var(--muted); font-size: .82rem; }
.rental strong { display: block; line-height: 1.2; margin-top: 4px; font-size: 1.55rem; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.rental-time strong { color: var(--accent); font-size: clamp(1.3rem, 4vw, 2.15rem); }
.rental button { width: 100%; }

.access {
  padding: clamp(22px, 4vw, 38px);
  border-radius: 24px;
  min-height: 345px;
  background: radial-gradient(ellipse at 100% 0%, #392638, transparent 70%), var(--surface);
}

.marker {
  width: 54px;
  height: 54px;
  margin-bottom: 16px;
  position: relative;
  border: 1px solid #69475c;
  border-radius: 16px;
  background: linear-gradient(var(--accent), var(--accent)) 50% 50% / 22px 2px no-repeat, #372438;
}
.marker::before, .marker::after { content: ""; position: absolute; left: 13px; right: 13px; height: 9px; border: 2px solid var(--accent); }
.marker::before { top: 13px; border-bottom: 0; border-radius: 4px 4px 0 0; }
.marker::after { bottom: 13px; border-top: 0; border-radius: 0 0 4px 4px; }

h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.1; letter-spacing: -.045em; }
p { color: var(--muted); }
.step { margin-top: 15px; }
.step > p { margin-bottom: 14px; }

button, .secondary {
  font: inherit;
  font-weight: 720;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 8px 13px;
  cursor: pointer;
  text-decoration: none;
}

.primary { background: linear-gradient(135deg, #ffb9db, #e795c3); color: #291421; }
.secondary, .tabs button { background: var(--raised); border-color: var(--line); color: var(--text); }
#start { display: block; width: min(100%, 340px); min-height: 54px; font-size: 1.05rem; }
#idle .sample { display: inline-block; margin-bottom: 15px; }

button:focus-visible, a:focus-visible, input:focus-visible, .paste-zone:focus-visible, .choose:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (hover: hover) { button:hover, .choose:hover { filter: brightness(1.13); } }

.loading { color: var(--text); font-size: 1.35rem; font-weight: 730; }
.loading span { display: inline-block; width: 1.6ch; color: var(--accent); }
.tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tabs button { padding-inline: 7px; }
.tabs [aria-pressed=true] { border-color: #a57091; color: #ffd2e9; background: #422c40; }
.scan-panel { margin: 10px 0 12px; }
.camera-hint { margin-bottom: 10px; }
.paste-zone { display: grid; justify-items: center; gap: 8px; background: #211923; border: 1px dashed #83627a; border-radius: 16px; padding: 19px; text-align: center; }
.paste-zone span { color: var(--muted); font-size: .88rem; }
kbd { font: inherit; padding: 0 5px; border: 1px solid var(--line); border-radius: 4px; }
.choose { position: relative; display: inline-flex; align-items: center; }
.choose input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
a { color: #ffc1df; text-underline-offset: 4px; }
video { width: 100%; max-height: 330px; border-radius: 15px; background: var(--raised); }
.success { color: var(--positive); font-weight: 720; }
#feedback { margin-top: 12px; color: var(--notice); }

.payment-note { padding: 13px 15px; margin-top: 10px; border-radius: 15px; }
.payment-confirmed { display: grid; gap: 2px; border-color: #4e8269; background: #1a2924; }
.payment-confirmed strong { color: var(--positive); }

dialog { width: min(440px, 100% - 30px); border-radius: 21px; padding: 23px; color: var(--text); background: var(--raised); }
dialog::backdrop { background: #0c080cbf; }
dialog h2 { margin-bottom: 10px; font-size: 1.42rem; }
dialog input { display: block; margin-top: 7px; width: 100%; min-height: 44px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

@media (max-width: 640px) {
  main { width: calc(100% - 28px); padding-top: max(17px, env(safe-area-inset-top)); }
  .topbar { margin-bottom: 13px; padding-bottom: 13px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 11px; }
  .rental { grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 12px; border-radius: 16px; }
  .rental-time { padding: 0; border: 0; }
  .rental strong { font-size: 1.2rem; }
  .rental button { padding-inline: 9px; font-size: .86rem; }
  .access { min-height: 320px; border-radius: 19px; }
  #start { width: 100%; }
}

.qr-mark {
  padding: 0;
  flex: 0 0 44px;
}

.qr-mark i {
  position: relative;
  width: 23px;
  height: 23px;
  background:
    linear-gradient(currentColor, currentColor) top left / 8px 2px,
    linear-gradient(currentColor, currentColor) top left / 2px 8px,
    linear-gradient(currentColor, currentColor) top right / 8px 2px,
    linear-gradient(currentColor, currentColor) top right / 2px 8px,
    linear-gradient(currentColor, currentColor) bottom left / 8px 2px,
    linear-gradient(currentColor, currentColor) bottom left / 2px 8px,
    linear-gradient(currentColor, currentColor) bottom right / 8px 2px,
    linear-gradient(currentColor, currentColor) bottom right / 2px 8px;
  background-repeat: no-repeat;
}

.qr-mark i::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 5px;
  width: 3px;
  height: 3px;
  background: currentColor;
  box-shadow: 10px 0, 0 10px, 10px 10px, 6px 6px;
}

.qr-page main { width: min(660px, calc(100% - 32px)); }

.qr-page .topbar {
  border: 0;
  justify-content: center;
  margin-bottom: 20px;
  padding: 8px 0;
}

.qr-page .access {
  min-height: 0;
  padding: clamp(18px, 5vw, 32px);
  background: linear-gradient(160deg, #261b25, var(--surface) 52%);
  box-shadow: 0 18px 56px #07050666;
}

.qr-page h1 { font-size: clamp(1.65rem, 5vw, 2.2rem); }
.qr-page .step { margin-top: 20px; }
.qr-page .scan-panel { margin: 12px 0 0; }
.qr-page .tabs button { min-height: 48px; }
.qr-page .tabs [aria-pressed=true] {
  background: #472e43;
  border-color: #b8799e;
  color: #ffe3f2;
}

.qr-page .paste-zone,
.qr-page #camera-panel {
  border-radius: 15px;
  background: #140f16;
  padding: clamp(18px, 4vw, 28px);
  text-align: center;
}

.qr-page .paste-zone { gap: 12px; }
.qr-page #camera-panel { border: 1px solid var(--line); }
.qr-page .camera-hint { max-width: 34ch; margin: 0 auto 15px; }
.qr-page .choose.primary,
.qr-page #camera-start {
  background: #f4a0c9;
  color: #291421;
  justify-content: center;
  padding-inline: 18px;
}

.scan-mark {
  position: relative;
  width: 52px;
  height: 52px;
  background: linear-gradient(var(--accent), var(--accent)) center / 26px 2px no-repeat;
}
.scan-mark::before, .scan-mark::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  height: 9px;
  border: 2px solid var(--accent);
}
.scan-mark::before { top: 7px; border-bottom: 0; border-radius: 6px 6px 0 0; }
.scan-mark::after { bottom: 7px; border-top: 0; border-radius: 0 0 6px 6px; }

.qr-page video { display: block; object-fit: contain; }
.qr-page #camera-stop { margin-top: 12px; }
.qr-page #feedback:empty { margin: 0; }
.qr-page #feedback:not(:empty) {
  padding: 10px 13px;
  border-radius: 10px;
  background: #34251e;
  border: 1px solid #6c4738;
}
.qr-page #feedback[data-kind=info]:not(:empty) {
  color: var(--text);
  background: var(--raised);
  border-color: var(--line);
}

.qr-result {
  background: #192620;
  border: 1px solid #487760;
  border-radius: 15px;
  padding: 17px;
  margin-bottom: 14px;
}
.qr-result h2 { color: var(--positive); font-size: 1.3rem; line-height: 1.25; }
.qr-result h2:focus-visible { outline: 2px solid var(--positive); outline-offset: 3px; }
.qr-result p { margin-top: 7px; color: var(--text); max-width: 48ch; }
.qr-page .qr-privacy {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 12px;
  font-size: .86rem;
}

@media (max-width: 500px) {
  .qr-page .topbar { justify-content: flex-start; margin-bottom: 10px; }
  .qr-page .choose, .qr-page #camera-start, .qr-page #camera-stop, .qr-page #again { width: 100%; }
}

@media (hover: none) and (pointer: coarse) {
  .qr-page .paste-shortcut { display: none; }
}
