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

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
}

body {
  font-family: Outfit, system-ui, sans-serif;
  color: #f4f6fa;
  background: #000;
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.glass {
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.07) 42%, rgba(12, 18, 28, 0.26));
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.48),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
}

/* ---------- backdrop (wallpaper behind the device) ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #05080f;
  overflow: hidden;
}

.backdrop-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* ---------- device: the real wallpaper shows through everywhere; ---------- */
/* only some breathing room from the edges is added on wide screens.  ---------- */

.device {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (min-width: 860px) {
  .topbar,
  .board,
  .legal-main {
    padding-left: max(5vw, 24px);
    padding-right: max(5vw, 24px);
  }

  .dock {
    padding-left: max(5vw, 24px);
    padding-right: max(5vw, 24px);
  }

  .device.device-static {
    height: 100dvh;
    overflow-y: auto;
  }
}

/* ---------- top status bar ---------- */

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 44px;
  padding: max(6px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left));
  position: relative;
  z-index: 30;
}

.topbar-home {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: #fff;
  min-height: 32px;
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.7));
}

.topbar-home-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  color: #fff;
}

.topbar-home-icon svg {
  width: 100%;
  height: 100%;
}

.topbar-home-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.7));
}

.lang-switch a {
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.68rem;
  font-weight: 600;
}

.lang-switch a:hover,
.lang-switch a[aria-current="true"] {
  color: #fff;
}

/* ---------- app board / springboard grid ---------- */

.board {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 6px max(14px, env(safe-area-inset-right)) 150px max(14px, env(safe-area-inset-left));
  -webkit-overflow-scrolling: touch;
}

.apps-empty {
  margin: 20vh auto;
  text-align: center;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.9rem;
  max-width: 28ch;
}

.springboard {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  justify-content: center;
  gap: 20px 10px;
  max-width: 760px;
  margin: 0 auto;
}

@media (min-width: 860px) {
  .springboard {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    max-width: none;
    gap: 26px 14px;
  }
}

.app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: #fff;
  padding: 0;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}

.app-icon {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 22%;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.5),
    0 2px 6px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.15s ease;
}

@media (min-width: 860px) {
  .app-icon {
    width: 68px;
    height: 68px;
  }
}

.app-tile:active .app-icon {
  transform: scale(0.92);
}

.app-icon svg {
  width: 56%;
  height: 56%;
}

.app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.app-lock {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 20px;
  height: 20px;
}

.app-lock svg {
  width: 100%;
  height: 100%;
}

.app-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-align: center;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7), 0 0 10px rgba(0, 0, 0, 0.4);
}

/* ---------- bottom dock ---------- */

.dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  display: flex;
  justify-content: center;
  padding: 0 max(14px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-bottom));
  pointer-events: none;
}

.dock-pill {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 20px;
  border-radius: 26px;
  max-width: 100%;
}

.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: #fff;
}

.dock-icon {
  width: 42px;
  height: 42px;
  border-radius: 22%;
  display: grid;
  place-items: center;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06));
  color: #ffd56a;
}

.dock-icon svg {
  width: 56%;
  height: 56%;
}

.dock-label {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
  white-space: nowrap;
}

@media (max-width: 420px) {
  .dock-pill {
    gap: 10px;
    padding: 8px 12px;
  }

  .dock-label {
    font-size: 0.52rem;
  }
}

/* ---------- overlays (contact / references / lock, slide up like opening an app) ---------- */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  background: rgba(3, 7, 14, 0);
  transition: background 0.3s ease;
  pointer-events: none;
}

.overlay.is-open {
  pointer-events: auto;
  background: rgba(3, 7, 14, 0.55);
}

.overlay-sheet {
  width: 100%;
  max-height: 92%;
  margin-top: auto;
  border-radius: 26px 26px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}

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

@media (min-width: 860px) {
  .overlay-sheet {
    width: min(620px, 92%);
    margin: auto;
    border-radius: 26px;
    max-height: 86%;
  }
}

.overlay-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 6px;
}

.overlay-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.overlay-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  display: grid;
  place-items: center;
}

.overlay-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 10px 22px max(22px, env(safe-area-inset-bottom));
}

/* reference cards reused inside the overlay */

.deck {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 14px;
}

.card {
  border-radius: 20px;
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  color: #f7f8fb;
}

.card-icon {
  width: 42px;
  height: 42px;
  color: #ff9a3c;
  margin-bottom: 14px;
}

.card-icon svg {
  width: 100%;
  height: 100%;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.card p {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 300;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.78);
}

/* contact form inside overlay */

.contact-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.contact-lead {
  margin: 0;
  font-weight: 300;
  font-size: 0.92rem;
  line-height: 1.5;
  color: rgba(247, 246, 242, 0.78);
}

.contact-card {
  border-radius: 20px;
  padding: 20px;
  display: grid;
  gap: 14px;
}

.contact-card label {
  display: grid;
  gap: 7px;
}

.contact-card span {
  font-size: 0.74rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.contact-card input,
.contact-card textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(8, 12, 20, 0.3);
  padding: 11px 13px;
  outline: none;
  resize: vertical;
}

.contact-card input:focus,
.contact-card textarea:focus {
  border-color: rgba(255, 154, 60, 0.7);
}

.send {
  justify-self: start;
  min-width: 120px;
  height: 44px;
  border-radius: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.82rem;
}

.send:hover {
  background: linear-gradient(165deg, rgba(255, 140, 40, 0.42), rgba(255, 255, 255, 0.08));
}

.mail {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  color: #fff;
  text-decoration: none;
  font-size: 0.88rem;
  width: fit-content;
}

.mail:hover {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08));
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-status {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.82rem;
  color: rgba(255, 213, 106, 0.9);
  opacity: 0;
}

.form-status.is-on {
  opacity: 1;
}

/* passcode lock sheet */

.lock-sheet {
  max-width: 100%;
}

.lock-form {
  display: grid;
  gap: 14px;
  padding: 6px 22px max(22px, env(safe-area-inset-bottom));
}

.lock-lead {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.lock-lead-sub {
  margin: -8px 0 0;
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.6);
}

.lock-field {
  display: grid;
  gap: 7px;
}

.lock-field span {
  font-size: 0.74rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.lock-field input {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(8, 12, 20, 0.3);
  padding: 12px 14px;
  outline: none;
  letter-spacing: 0.3em;
  font-size: 1.1rem;
}

.lock-field input:focus {
  border-color: rgba(255, 154, 60, 0.7);
}

.lock-remember {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.75);
}

.lock-form.is-shake {
  animation: lockShake 0.4s ease;
}

@keyframes lockShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

.lock-error {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.82rem;
  color: #ff9a9a;
}

/* ---------- legal pages reuse the same device chrome ---------- */

.legal-body {
  background: transparent;
}

.legal-main {
  flex: 1 1 auto;
  overflow-y: auto;
  max-width: 680px;
  margin: 0 auto;
  padding: 2vh 24px 140px;
  width: 100%;
}

.legal-card {
  border-radius: 22px;
  padding: 28px 28px 32px;
  margin-top: 6px;
}

.legal-card h1 {
  margin: 0 0 20px;
}

@media (prefers-reduced-motion: reduce) {
  .overlay-sheet,
  .app-icon {
    transition: none;
  }

  .lock-form.is-shake {
    animation: none;
  }
}
