:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #8a8f95;
  --border: #e2e4e8;
  --line: #f0f1f3;
  --accent: #111111;
  --border-focus: #111111;
  --field-bg: #ffffff;
  --subtle-bg: #f6f7f8;
  --hover-bg: #f2f3f5;
  --placeholder: #a8adb3;
  --radius: 14px;
  --radius-btn: 12px;
  --font: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --page-max: 420px;
  --page-pad-x: 20px;
  --header-h: 60px;
  --tabbar-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

a,
button,
input,
label {
  touch-action: manipulation;
}

a {
  color: var(--text);
}

@font-face {
  font-family: "Material Symbols Outlined";
  font-style: normal;
  font-weight: 400 700;
  font-display: block;
  src: url("../fonts/material-symbols-subset.woff2") format("woff2");
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.top__inner {
  width: 100%;
  max-width: var(--page-max);
  height: var(--header-h);
  margin: 0 auto;
  padding: 0 var(--page-pad-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.top__brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.top__logo {
  height: 34px;
  width: auto;
  display: block;
}

.top__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top__btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.top__btn:active {
  transform: scale(0.97);
}

.top__btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.page {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 28px)
           var(--page-pad-x)
           calc(40px + env(safe-area-inset-bottom, 0px));
}

body.has-tabbar .page {
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 36px);
}

.page__title {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin: 0 0 10px;
}

.page__desc {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 32px;
}

.page__desc strong {
  color: var(--text);
  font-weight: 600;
}

.page__section {
  margin: 0 0 36px;
}

.page__label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 12px;
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tabbar__inner {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  display: flex;
}

.tabbar__item {
  flex: 1;
  height: var(--tabbar-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
}

.tabbar__item .material-symbols-outlined {
  font-size: 26px;
}

.tabbar__item--connect .material-symbols-outlined {
  font-size: 30px;
}

.tabbar__item.is-active {
  color: var(--text);
}

.tabbar__item.is-active .material-symbols-outlined {
  font-variation-settings: "FILL" 1;
}

.savebar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  z-index: 29;
  padding: 18px var(--page-pad-x) 12px;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.97) 60%, rgba(255, 255, 255, 0));
  pointer-events: none;
}

.savebar .btn {
  pointer-events: auto;
  display: flex;
  width: 100%;
  max-width: calc(var(--page-max) - 40px);
  margin: 0 auto;
}

body.has-savebar .page {
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 100px);
}

.field {
  position: relative;
  text-align: left;
  margin: 0 0 14px;
}

.field__label {
  position: absolute;
  left: 14px;
  top: -8px;
  padding: 0 4px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  z-index: 1;
}

.field:focus-within .field__label {
  color: var(--text);
}

.field__input--secret,
.auth__input.field__input--secret {
  -webkit-text-security: disc;
  -webkit-text-security: disc;
}

.field__input {
  width: 100%;
  min-height: 50px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.field__input::placeholder {
  color: var(--placeholder);
}

.field__input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--border-focus);
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 0 18px;
  border: none;
  border-radius: var(--radius-btn);
  background: var(--text);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: scale(0.985);
}

.btn:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn--ghost:active {
  background: var(--hover-bg);
}

.btn--danger {
  background: transparent;
  color: #d93025;
  border: 1px solid var(--border);
}

.btn--danger:active {
  background: #fdecea;
  border-color: #d93025;
}

.btn--sm {
  width: auto;
  min-height: 44px;
  padding: 0 20px;
  font-size: 0.88rem;
  border-radius: 12px;
}

.btn + .btn {
  margin-top: 10px;
}

.form-actions {
  margin-top: 22px;
}

.textlink {
  appearance: none;
  border: none;
  background: none;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.textlink:hover {
  color: var(--text);
}

.textlink--danger {
  color: #d93025;
}

.textlink--danger:hover {
  color: #b3261e;
}

.account-form .field:last-of-type {
  margin-bottom: 4px;
}

.account-logout {
  margin-top: 8px;
  padding-top: 8px;
}

.footnote {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.88rem;
}

.footnote a {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.footnote a:hover {
  text-decoration: underline;
}

body.auth-page {
  --accent: #3390ec;
  --border-focus: #3390ec;
}

body.auth-page .page {
  text-align: center;
  max-width: 380px;
  padding-top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 36px);
}


body.auth-page--popup .top,
body.app-page--popup .top {
  display: none;
}

body.auth-page--popup .page,
body.app-page--popup .page {
  max-width: 100%;
  padding-left: 20px;
  padding-right: 20px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 36px);
}

body.auth-page--popup .auth__service {
  width: 88px;
  height: 88px;
  margin-bottom: 14px;
}

body.auth-page--popup .auth__service--x {
  width: 96px;
  height: 96px;
}

body.auth-page--popup .auth__service--tg {
  width: 112px;
  height: 112px;
}

.auth__service {
  width: 104px;
  height: 104px;
  margin: 6px auto 18px;
  display: block;
  object-fit: contain;
}

.auth__service--x {
  width: 104px;
  height: 104px;
}


.auth__service--tg {
  width: 120px;
  height: 120px;
}

.auth__title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  line-height: 1.25;
}

.auth__subtitle {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 0 0 26px;
}

.auth__subtitle strong {
  color: var(--text);
  font-weight: 600;
}

.auth__field {
  position: relative;
  text-align: left;
  margin: 0 0 14px;
}

.auth__field--static {
  pointer-events: none;
  user-select: none;
}

.auth__label {
  position: absolute;
  left: 14px;
  top: -8px;
  padding: 0 4px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  z-index: 1;
}

.auth__field:focus-within .auth__label {
  color: var(--accent);
}

.auth__control {
  width: 100%;
  min-height: 50px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth__field:focus-within .auth__control,
.auth__input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--border-focus);
}

.auth__input {
  width: 100%;
  min-height: 50px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0.02em;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.auth__input::placeholder {
  color: var(--placeholder);
}

.auth__btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin: 22px 0 0;
  border: none;
  border-radius: var(--radius-btn);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.auth__btn[hidden] {
  display: none !important;
}

.auth__btn:active {
  transform: scale(0.985);
}

.auth__btn:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
}

.auth__link {
  appearance: none;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  padding: 10px;
  margin: 16px 0 0;
  min-height: 44px;
}

.auth__link:hover {
  text-decoration: underline;
}

.auth__link:disabled,
.auth__link.is-waiting {
  color: var(--muted);
  cursor: default;
  text-decoration: none;
}

.auth__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
}

.auth__back:hover {
  color: var(--text);
}

.toast-host {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 var(--page-pad-x);
  pointer-events: none;
}

body.has-tabbar .toast-host {
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
}

body.has-savebar .toast-host {
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 92px);
}

.toast {
  max-width: min(360px, 100%);
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(17, 17, 17, 0.92);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-in {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-out {
  opacity: 0;
  transform: translateY(6px);
}

.toast--error {
  background: rgba(185, 28, 28, 0.94);
}

.toast--success {
  background: rgba(17, 17, 17, 0.92);
}

.confirm {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.confirm.is-in {
  opacity: 1;
}

.confirm.is-out {
  opacity: 0;
  pointer-events: none;
}

.confirm__backdrop {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.4);
}

.confirm__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 340px;
  padding: 28px 22px 18px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
  transform: translateY(8px) scale(0.98);
  transition: transform 0.18s ease;
  box-sizing: border-box;
}

.confirm.is-in .confirm__panel {
  transform: translateY(0) scale(1);
}

.confirm__msg {
  margin: 0 0 22px;
  padding: 0;
  color: #111111;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 650;
  line-height: 1.45;
  text-align: center;
  letter-spacing: -0.02em;
}

.confirm__actions {
  display: flex;
  gap: 10px;
}

.confirm button.confirm__btn {
  -webkit-appearance: none;
  appearance: none;
  flex: 1 1 0;
  min-width: 0;
  min-height: 50px;
  margin: 0;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  outline: none;
  box-shadow: none;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.confirm button.confirm__btn:active {
  transform: scale(0.98);
}

.confirm button.confirm__btn--cancel {
  background: #e8e9eb;
  background-color: #e8e9eb;
  color: #55585c;
}

.confirm button.confirm__btn--ok {
  background: #111111;
  background-color: #111111;
  color: #ffffff;
}

html.webapp-gate,
html.webapp-gate body {
  height: 100%;
  overflow: hidden;
}

html.webapp-gate body {
  background:
    radial-gradient(120% 80% at 50% -10%, #f3f4f6 0%, transparent 55%),
    var(--bg);
}

html.webapp-gate body > :not(.webapp-gate-screen) {
  display: none !important;
}

.webapp-gate-screen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: calc(28px + env(safe-area-inset-top, 0px))
           var(--page-pad-x)
           calc(28px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 600px) {
  .webapp-gate-screen {
    inset: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(var(--page-max), calc(100% - 40px));
    max-height: min(640px, calc(100dvh - 48px));
    overflow: auto;
    box-sizing: border-box;
  }
}

html.webapp-gate .webapp-gate-screen,
html.webapp-gate .webapp-gate-screen[hidden] {
  display: flex !important;
}

html.webapp-gate .webapp-gate-screen__os[hidden] {
  display: none !important;
}

.webapp-gate-screen__logo {
  display: block;
  width: auto;
  height: 64px;
  margin: 0 auto 23px;
}

.webapp-gate-screen__title {
  margin: 0;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.3;
}

.webapp-gate-screen__lead {
  margin: 10px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.webapp-gate-screen__os {
  margin-top: 28px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.webapp-gate-screen__os + .webapp-gate-screen__os {
  margin-top: 12px;
}

.webapp-gate-screen__os-name {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 700;
}

.webapp-gate-screen__steps {
  margin: 0;
  padding: 0 0 0 1.15rem;
  font-size: 0.88rem;
  line-height: 1.55;
}

.webapp-gate-screen__steps li + li {
  margin-top: 6px;
}

.webapp-gate-screen__steps strong {
  font-weight: 700;
}

