:root {
  --bg: #121418;
  --surface: #1b1e23;
  --input: #2c3036;
  --input-border: #3a3f47;
  --text: #f2f3f5;
  --muted: #8b919c;
  --accent: #ee274b;
  --accent-dim: rgba(238, 39, 75, 0.15);
  --radius-pill: 26px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "PingFang SC",
    "Microsoft JhengHei", "Noto Sans TC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(12px + env(safe-area-inset-top)) 20px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.header-title {
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 8px 0 20px;
}

.logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}

.logo {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  object-fit: cover;
  background: #0c0d10;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.logo-fallback::before {
  content: "";
  width: 88px;
  height: 88px;
  border-radius: 22px;
  display: block;
  background: linear-gradient(145deg, #2563ff 0%, #a855f7 55%, #ec4899 100%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 22px;
}

.tab {
  position: relative;
  padding: 8px 4px;
  font-size: 16px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.tab.active {
  color: var(--text);
  font-weight: 600;
}

.tab.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 36px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.panel {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.panel.active {
  display: flex;
}

.field {
  position: relative;
}

.field-row-phone {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.cc-btn {
  flex-shrink: 0;
  min-width: 96px;
  height: 52px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--input-border);
  background: var(--input);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.cc-btn .chev {
  font-size: 10px;
  opacity: 0.7;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"] {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--input-border);
  background: var(--input);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
}

input::placeholder {
  color: #6e7480;
}

input:focus {
  border-color: rgba(238, 39, 75, 0.45);
}

.field-code input {
  padding-right: 108px;
}

.btn-code {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  height: 40px;
  padding: 0 12px;
  border: none;
  border-radius: 20px;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.btn-code:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.field-pwd .eye {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
}

.field-pwd input {
  padding-right: 48px;
}

.btn-register {
  margin-top: 8px;
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #f53d5f 0%, var(--accent) 100%);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(238, 39, 75, 0.35);
}

.btn-register:active {
  transform: scale(0.99);
}

.agree {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.agree input {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.agree a {
  color: var(--text);
  text-decoration: none;
}

.agree a:hover {
  color: var(--accent);
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 100;
}

.sheet-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 72vh;
  background: #fff;
  border-radius: 20px 20px 0 0;
  z-index: 101;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.sheet.open {
  transform: translateY(0);
}

.sheet-head {
  position: relative;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #eee;
}

.sheet-title {
  font-weight: 600;
  color: #111;
  font-size: 16px;
}

.sheet-close {
  position: absolute;
  right: 16px;
  top: 14px;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: #888;
  cursor: pointer;
}

.sheet-list-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 200px;
}

.sheet-list {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  max-height: calc(72vh - 140px);
}

.sheet-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid #eee;
  font-size: 15px;
  color: #111;
  cursor: pointer;
}

.sheet-item.selected {
  background: var(--accent-dim);
}

.sheet-item .code {
  color: #666;
  font-variant-numeric: tabular-nums;
}

.sheet-loading {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.75);
  display: grid;
  place-items: center;
  z-index: 2;
}

.sheet-loading.hidden {
  display: none;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #ddd;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.sheet-footer {
  display: flex;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid #eee;
  background: #fff;
}

.sheet-footer button {
  flex: 1;
  height: 48px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.btn-cancel-sheet {
  border: 1px solid #ccc;
  background: #fff;
  color: #111;
}

.btn-confirm-sheet {
  border: none;
  background: var(--accent);
  color: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 18px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 14px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
