body { background: #1C1C1C; }
#app {
  max-width: 480px; min-height: 100dvh; margin: 0 auto;
  background: var(--bg); position: relative; overflow-x: hidden;
}
@media (min-width: 481px) { #app { box-shadow: 0 0 60px rgba(0, 0, 0, .4); } }
@media (max-width: 480px) { html, body { background: var(--bg); overscroll-behavior-y: none; } }
.swipe, .part { -webkit-user-select: none; user-select: none; }

.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.with-tabs > .sheet, .with-tabs > .bike-sheet { padding-bottom: calc(max(30px, var(--safe-b) + 16px) + 82px); }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: max(clamp(24px, 8dvh, 72px), calc(var(--safe-t) + 30px)) 28px clamp(18px, 4dvh, 36px);
}
.top h1 { margin: 0; font-size: clamp(30px, 9.5vw, 38px); font-weight: 400; letter-spacing: -0.5px; line-height: 1.1; }
.yellow-top { background: var(--yellow); }
.yellow-top .top h1 { color: var(--ink); }
.sheet {
  flex: 1; background: var(--bg); border-radius: 40px 40px 0 0;
  padding: clamp(22px, 4.5dvh, 36px) clamp(16px, 6vw, 24px) 32px;
}
.actions { margin-top: auto; padding: clamp(14px, 3dvh, 24px) 28px max(clamp(16px, 4dvh, 32px), calc(var(--safe-b) + 8px)); }
.btn-pill {
  border: 2px solid var(--yellow); background: transparent; color: var(--yellow);
  border-radius: 10px; padding: 6px 18px; font-weight: 500; font-size: 16px; white-space: nowrap; text-decoration: none;
}

.welcome {
  background: linear-gradient(180deg, var(--yellow-2) 0%, #F2C94A 22%, #8A7A45 52%, var(--bg) 68%);
  text-align: center;
}
.welcome .brand { padding: max(clamp(40px, 12dvh, 104px), calc(var(--safe-t) + 56px)) 32px 0; }
.welcome .brand img { width: 100%; max-width: 330px; display: block; margin: 0 auto; }
.welcome .brand p { margin: 6px 0 0; color: var(--ink); font-size: 15px; }
.welcome .hero { flex: 1; display: flex; align-items: center; justify-content: center; padding: 8px 12px; }
.welcome .hero img { width: 100%; max-width: 380px; max-height: 42dvh; object-fit: contain; filter: drop-shadow(0 24px 30px rgba(0, 0, 0, .35)); }
.closed-note { margin: 4px 0 0; text-align: center; color: var(--muted); font-size: 14px; }

.bike-list { display: flex; flex-direction: column; gap: 12px; }
.bike-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 14px 20px; text-align: left;
  background: transparent; border: 2px solid var(--yellow); border-radius: var(--radius);
  color: inherit; text-decoration: none;
}
.bike-card:disabled { opacity: .45; cursor: default; }
.bike-card .name { font-family: var(--display); font-weight: 600; font-size: 20px; color: var(--yellow); line-height: 1.2; }
.bike-card .spec { font-size: 12px; margin-top: 2px; }
.bike-card .spec-2 { font-size: 9px; color: var(--muted); margin-top: 2px; }
.bike-card .rate { font-style: italic; font-size: 17px; white-space: nowrap; text-align: right; }
.bike-card > div:first-child { min-width: 0; }
.bike-card .tag-mine { font-variant-numeric: tabular-nums; }
.bike-card .side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }

.bike-screen { background: linear-gradient(180deg, #4A4A4A 0%, var(--bg) 46%); }
.bike-screen .top { color: var(--text); padding-bottom: 8px; }
.bike-hero { position: relative; padding: 0 16px; text-align: center; margin-top: auto; }
.bike-screen .bike-sheet { margin-bottom: auto; }
.bike-hero .model {
  position: absolute; left: 0; right: 0; top: 4px; z-index: 0;
  font-family: var(--display); font-style: italic; font-weight: 500;
  font-size: clamp(26px, 10.5vw, 44px); letter-spacing: clamp(2px, 1.4vw, 6px); color: var(--yellow);
  text-transform: uppercase; white-space: nowrap;
}
.bike-hero img { position: relative; z-index: 1; width: 82%; max-width: 330px; max-height: 32dvh; object-fit: contain; margin-top: 10px; }
.bike-sheet {
  margin-top: -10px; position: relative; z-index: 2;
  background: var(--bg); border-radius: 40px 40px 0 0; padding: 22px 22px 28px;
  display: flex; flex-direction: column;
}
.timer {
  font-family: var(--display); font-weight: 600; font-size: 30px; text-align: center; letter-spacing: 1px;
  margin: clamp(10px, 2.2dvh, 18px) 0 clamp(14px, 3dvh, 26px); font-variant-numeric: tabular-nums;
}

.swipe {
  position: relative; height: clamp(62px, 9dvh, 74px); border-radius: 999px; background: var(--yellow);
  touch-action: none; overflow: hidden;
}
.swipe .swipe-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--ink); font-size: 15px; font-weight: 500; pointer-events: none; transition: opacity .15s;
}
.swipe .knob {
  --size: clamp(50px, 7.4dvh, 60px);
  position: absolute; top: 50%; left: 7px; width: var(--size); aspect-ratio: 1; margin-top: calc(var(--size) / -2);
  border-radius: 50%; background: #000; border: 0; padding: 0; cursor: grab; touch-action: none;
  display: flex; align-items: center; justify-content: center;
}
.swipe .knob:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.swipe.busy { opacity: .6; pointer-events: none; }

.requests { height: 100dvh; min-height: 0; }
.requests-lead { margin: -22px 28px 18px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.requests-list { display: flex; flex-direction: column; gap: 10px; padding: 0 24px; flex: 1; overflow-y: auto; min-height: 0; }
.requests .actions { padding-top: 16px; }
.request { border: 2px solid #4A4A4A; border-radius: var(--radius); padding: 14px 16px; }
.request .parts { display: flex; flex-wrap: wrap; gap: 6px; }
.request p { margin: 10px 0 0; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.request .meta { margin-top: 8px; font-size: 12px; color: var(--muted); }

.part-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(8px, 1.5dvh, 12px); padding: 0 clamp(16px, 6vw, 24px); }
.part {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 18px;
  min-height: clamp(80px, 13dvh, 112px); padding: clamp(12px, 2dvh, 16px); border-radius: var(--radius);
  background: transparent; border: 2px solid var(--yellow); color: var(--yellow);
  font-weight: 600; font-size: 16px; text-align: left;
}
.part[aria-pressed="true"] { background: var(--yellow); color: var(--ink); }
.part svg { width: 34px; height: 34px; }
.repair-form { margin-top: 16px; }
.counter { margin-top: -8px; text-align: right; font-size: 12px; color: var(--muted); }

.calc-meta { display: flex; justify-content: space-between; margin: -22px 28px 16px; color: var(--muted); font-size: 14px; }
.calc-display { margin: 0 24px; padding: 18px 20px; border-radius: 18px; background: var(--bg-2); text-align: right; }
.calc-display .num {
  font-family: var(--display); font-weight: 700; font-size: clamp(44px, 8dvh, 64px); line-height: 1; color: var(--text);
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.calc-display .formula { margin-top: 10px; color: var(--muted); font-size: 15px; }
.calc-display .formula b { color: var(--yellow); font-size: 20px; }
.keypad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(6px, 1.2dvh, 10px);
  padding: clamp(10px, 2dvh, 16px) clamp(16px, 6vw, 24px) 0;
}

.summary { margin: 0 24px; border-radius: 18px; background: var(--bg-2); padding: 8px 20px; }
.summary .row { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid #3A3A3A; }
.summary .row:last-child { border-bottom: 0; }
.summary .row span:first-child { color: var(--muted); }
.summary .total span:last-child { color: var(--yellow); font-family: var(--display); font-weight: 700; font-size: 24px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--bg-2); border-radius: 14px; padding: 12px; min-width: 0; }
.stat b { display: block; font-family: var(--display); font-size: clamp(15px, 5vw, 20px); color: var(--yellow); white-space: nowrap; }
.stat span { font-size: 12px; color: var(--muted); }
.history { display: flex; flex-direction: column; gap: 10px; }
.h-item { background: var(--bg-2); border-radius: 14px; padding: 14px 16px; display: flex; justify-content: space-between; gap: 12px; }
.h-item .bike { font-family: var(--display); font-weight: 600; color: var(--yellow); }
.h-item .meta { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.h-item .sum { text-align: right; white-space: nowrap; font-weight: 600; }
.h-item .sum small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 4px; }
.h-item .sum .tag { margin-top: 6px; }
.history-note { margin: 16px 0 0; font-size: 12px; color: var(--muted); text-align: center; }

.section { margin-top: 30px; }
.section h2 { font-size: 20px; font-weight: 500; margin: 0 0 14px; }
.section .form { padding: 0; }
.btn-logout { margin-top: 36px; background: transparent; border-color: #4A4A4A; color: var(--danger); }
.btn-logout svg { width: 20px; height: 20px; }

.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 20;
  bottom: max(30px, calc(var(--safe-b) + 16px));
  width: calc(100% - 32px); max-width: 448px;
  display: flex; padding: 6px; border-radius: 999px;
  background: #1B1B1B; border: 1px solid #3A3A3A;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
}
.tab-indicator {
  position: absolute; top: 6px; bottom: 6px; left: 6px;
  width: calc((100% - 12px) / var(--n)); border-radius: 999px; background: var(--yellow);
  transform: translateX(calc(var(--i) * 100%));
  transition: transform .35s var(--spring);
}
.tabbar a {
  position: relative; z-index: 1; flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 7px 0 6px; border-radius: 999px;
  font-size: 11px; font-weight: 500; color: #A8A8A8; text-decoration: none; transition: color .25s;
}
.tabbar a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.tabbar svg { width: 23px; height: 23px; }

.splash { position: fixed; inset: 0; z-index: 100; background: var(--bg); transition: opacity .4s; }
.splash iframe { width: 100%; height: 100%; border: 0; display: block; }
.splash.hide { opacity: 0; pointer-events: none; }

.page-enter.yellow-top > .sheet { animation: none !important; }
.page-enter.yellow-top > .sheet > * { animation: page-in .34s .05s cubic-bezier(.2, .8, .2, 1) both; }

@media (prefers-reduced-motion: reduce) { .tab-indicator { transition: none; } }

.standalone, .standalone body { height: var(--app-h); overflow: hidden; }
.standalone #app { height: var(--app-h); min-height: 0; overflow: hidden; }
.standalone .screen { height: 100%; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.standalone .tabbar { position: absolute; }
.standalone .splash,
.standalone .modal,
.standalone .loader { position: absolute; inset: auto; top: 0; left: 0; width: 100%; height: var(--app-h); }

@media (max-height: 700px) {
  .part { flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; min-height: 0; height: clamp(50px, 9dvh, 60px); }
  .part svg { width: 26px; height: 26px; flex: none; }
  .bike-hero img { max-height: 28dvh; }
  .bike-sheet { padding-top: 16px; padding-bottom: 16px; }
}
@media (max-height: 600px) {
  .bike-hero .model { font-size: clamp(22px, 9vw, 34px); }
  .bike-hero img { max-height: 22dvh; margin-top: 4px; }
  .calc-display { padding: 10px 16px; }
  .calc-display .num { font-size: 38px; }
  .calc-display .formula { margin-top: 4px; }
  .key { height: 44px; font-size: 22px; }
  .top { padding-top: max(18px, calc(var(--safe-t) + 20px)); padding-bottom: 14px; }
  .top h1 { font-size: 28px; }
  .calc-meta, .requests-lead { margin-top: -6px; }
}
