@font-face {
  font-family: "YS Geo";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/YSGeo-Regular.ttf") format("truetype");
}

@font-face {
  font-family: "YS Geo";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./fonts/YSGeo-Medium.ttf") format("truetype");
}

:root {
  --bg: #ffffff;
  --text: rgba(0, 0, 0, 0.9);
  --muted: rgba(0, 0, 0, 0.4);
  --pin: #a68aff;
  --font: "YS Geo", -apple-system, BlinkMacSystemFont, sans-serif;
  --pad-x: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

button {
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}

.gate__form {
  width: min(320px, 100%);
  display: grid;
  gap: 12px;
}

.gate__label {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.16px;
}

.gate__input {
  width: 100%;
  height: 48px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 16px;
  padding: 0 14px;
  font: inherit;
  font-size: 16px;
  background: #fff;
}

.gate__input:focus {
  outline: 2px solid var(--pin);
  outline-offset: 1px;
}

.gate__submit {
  height: 48px;
  border-radius: 16px;
  background: #1d1828;
  color: #fff;
  font-weight: 500;
  text-align: center;
}

.gate__error {
  font-size: 14px;
  color: #c62828;
}

.app {
  display: none;
  position: relative;
  overflow: hidden;
  height: 100dvh;
  height: 100svh;
  flex-direction: column;
  background: var(--bg);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

body.is-open .app {
  display: flex;
}

.nav {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  flex-shrink: 0;
}

.nav__spacer {
  width: 36px;
  height: 36px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.icon-btn img {
  display: block;
  width: 15px;
  height: 15px;
}

.icon-btn img[src*="settings"] {
  width: 20px;
  height: 20px;
}

.sidebar {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0 var(--pad-x);
  display: flex;
  flex-direction: column;
}

.menu {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.row {
  min-height: 48px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: 0.16px;
  color: var(--text);
}

.row__icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.row__icon img {
  display: block;
}

.row__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row__external {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.row--plain {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticker-slot {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 54px;
  margin: 12px 0;
  flex-shrink: 0;
  isolation: isolate;
}

.sticker-reveal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 27px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: 0.16px;
  z-index: 1;
}

.sticker-reveal.is-done {
  background: transparent;
}

.sticker-stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  touch-action: none;
}

body:not(.is-open) .sticker-stage {
  display: none;
}

.sticker-stage:not(.is-ready) {
  visibility: hidden;
}

#sticker-target {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#sticker-target canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  outline: none;
  box-shadow: none;
  touch-action: none;
  pointer-events: none;
}

.sticker-hit {
  position: absolute;
  width: 48px;
  height: 48px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  appearance: none;
  -webkit-appearance: none;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  z-index: 2;
  user-select: none;
}

.sticker-hit:focus {
  outline: none;
}

.sticker-stage.is-peeling .sticker-hit {
  cursor: grabbing;
}

.sticker-stage.is-detached .sticker-hit {
  pointer-events: none;
}

.sticker-stage.is-detached #sticker-target {
  visibility: hidden;
}

.history {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.history h2 {
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.12px;
  color: var(--muted);
  padding: 6px 12px;
  margin-top: 8px;
}

.history h2:first-child {
  margin-top: 0;
}

.profile {
  flex-shrink: 0;
  background: var(--bg);
  z-index: 4;
}

.profile__bar {
  height: 60px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.profile__user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.35px solid #55ffc2;
  display: grid;
  place-items: center;
}

.avatar img {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.profile__name {
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
  letter-spacing: 0.14px;
}

.profile__sub {
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.12px;
  background: radial-gradient(circle at 100% 0, #55ffc2, #32bbe8 50%, #5688f3 75%, #7a55ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.disclaimer {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 9px;
  line-height: 16px;
  letter-spacing: 0.09px;
  color: var(--muted);
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 12;
  transform: translateY(100%);
  transition: transform 400ms ease;
  pointer-events: none;
  background: #6b4dff;
}

.sheet.is-open {
  transform: translateY(0);
  pointer-events: auto;
}

.sheet img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.server {
  display: none;
}

@media (min-width: 900px) {
  body.is-open {
    display: grid;
    grid-template-columns: 390px minmax(0, 1fr);
    background: #f3f2f5;
  }

  body.is-open .app {
    min-width: 0;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
  }

  body.is-open .server {
    display: flex;
    flex-direction: column;
    gap: 28px;
    min-width: 0;
    height: 100dvh;
    height: 100svh;
    overflow: auto;
    padding: 36px 40px;
    color: var(--text);
  }

  .server__title {
    font-size: 20px;
    font-weight: 500;
    line-height: 24px;
    letter-spacing: 0.16px;
  }

  .server__block {
    display: grid;
    gap: 8px;
    max-width: 420px;
  }

  .server__label {
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    letter-spacing: 0.12px;
    color: var(--muted);
  }

  .server__link,
  .server__hint a {
    color: var(--pin);
    font-size: 15px;
    line-height: 22px;
    letter-spacing: 0.12px;
    word-break: break-all;
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  .server__hint {
    font-size: 14px;
    line-height: 20px;
    letter-spacing: 0.12px;
    color: rgba(0, 0, 0, 0.56);
  }

  .server__hint a {
    font-size: inherit;
    word-break: break-all;
  }

  .server__code {
    display: block;
    padding: 12px 14px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
    line-height: 18px;
    color: var(--text);
    word-break: break-all;
  }
}

.tuner {
  position: fixed;
  top: 270px;
  right: 12px;
  z-index: 16;
  width: min(276px, calc(100vw - 24px));
  max-height: calc(100dvh - 282px);
  overflow: auto;
  pointer-events: auto;
  color: #f4f1fa;
  background: rgba(18, 16, 24, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px 12px 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.tuner[hidden] {
  display: none;
  pointer-events: none;
}

@media (max-height: 600px) {
  .tuner {
    top: 12px;
    max-height: calc(100svh - 24px);
  }
}

.tuner__form {
  display: grid;
  gap: 6px;
}

.tuner__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.tuner__head strong {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12px;
}

.tuner__hint {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08px;
  color: rgba(255, 255, 255, 0.4);
  padding: 1px 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
}

.tuner__reset {
  margin-left: auto;
  height: 24px;
  padding: 0 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  text-align: center;
}

.tuner__section {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12px;
  color: rgba(255, 255, 255, 0.45);
}

.tuner__row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
}

.tuner__row--field {
  grid-template-columns: 72px minmax(0, 1fr);
}

.tuner__name {
  font-size: 11px;
  letter-spacing: 0.08px;
  color: rgba(255, 255, 255, 0.72);
}

.tuner__value {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  text-align: right;
  color: rgba(255, 255, 255, 0.88);
}

.tuner__row input[type="range"] {
  width: 100%;
  accent-color: var(--pin);
}

.tuner__row select {
  width: 100%;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: inherit;
  font-size: 11px;
}

.tuner__check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  font-size: 11px;
  letter-spacing: 0.08px;
  color: rgba(255, 255, 255, 0.72);
}

.tuner__check input {
  accent-color: var(--pin);
}
