/* Estrutura da página: fio de luzes, topo (marca, abas, ferramentas), botões, rodapé e avisos. */

.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

.app__main {
  flex: 1;
}

/* ---------- fio de luzinhas ---------- */

.lights {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 54px;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='54' viewBox='0 0 280 54'%3E%3Cpath d='M0 5Q70 36 140 5Q210 36 280 5' fill='none' stroke='%23234563' stroke-width='2.2'/%3E%3Cg fill='%23b88a52'%3E%3Crect x='67' y='19.5' width='6' height='6' rx='1'/%3E%3Crect x='207' y='19.5' width='6' height='6' rx='1'/%3E%3C/g%3E%3Cg fill='%23ffd88a'%3E%3Cellipse cx='70' cy='31' rx='5.5' ry='7.5'/%3E%3Cellipse cx='210' cy='31' rx='5.5' ry='7.5'/%3E%3C/g%3E%3C/svg%3E") repeat-x 0 0 / 280px 54px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.lights::before,
.lights::after {
  content: '';
  position: absolute;
  inset: 0;
  background-repeat: repeat-x;
  background-size: 280px 54px;
}

.lights::before {
  background-image: radial-gradient(circle at 70px 31px, rgba(255, 216, 130, 0.95) 0, rgba(255, 190, 90, 0.42) 9px, transparent 28px);
  animation: twinkle 3.4s ease-in-out infinite;
}

.lights::after {
  background-image: radial-gradient(circle at 210px 31px, rgba(255, 216, 130, 0.95) 0, rgba(255, 190, 90, 0.42) 9px, transparent 28px);
  animation: twinkle 3.4s ease-in-out -1.7s infinite;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
}

/* ---------- topo ---------- */

.topbar {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 34px var(--gutter) 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand__mark {
  width: 58px;
  height: 58px;
  flex: none;
  filter: drop-shadow(0 5px 0 rgba(0, 0, 0, 0.28));
  transform: rotate(-4deg);
}

.kicker {
  display: inline-block;
  padding: 5px 11px;
  background: var(--gold-500);
  color: var(--ink-900);
  font: 600 11.5px/1.2 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand__title {
  margin-top: 7px;
  font: 800 clamp(28px, 3.6vw, 42px)/1 var(--font-display);
  letter-spacing: -0.01em;
  color: var(--cream);
}

.tabs {
  justify-self: center;
  display: flex;
  gap: 6px;
  padding: 6px;
  background: rgba(7, 17, 26, 0.72);
  border: 2px solid var(--navy-700);
  border-radius: 999px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--kraft-300);
  font: 700 19px/1 var(--font-body);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, color 0.2s, transform 0.12s var(--ease-out);
}

.tab .icon {
  width: 22px;
  height: 22px;
}

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

.tab[aria-selected='true'] {
  background: linear-gradient(180deg, var(--gold-300), var(--gold-500));
  color: var(--ink-900);
  box-shadow: 0 4px 0 var(--gold-700), inset 0 2px 0 rgba(255, 255, 255, 0.5);
}

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

.tool {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 2px solid var(--navy-700);
  border-radius: 50%;
  background: rgba(24, 50, 73, 0.8);
  color: var(--cream);
  font-size: 24px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s var(--ease-out), color 0.2s, border-color 0.2s;
}

.tool:active {
  transform: scale(0.92);
}

.tool[aria-pressed='false'] {
  color: #7d9cbc;
  border-style: dashed;
}

.tool[hidden] {
  display: none;
}

.tool .icon--off {
  display: none;
}

.tool[aria-pressed='false'] .icon--on {
  display: none;
}

.tool[aria-pressed='false'] .icon--off {
  display: block;
}

.footer {
  padding: 18px var(--gutter) 26px;
  text-align: center;
  font: 500 12px/1.6 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5f8ab3;
}

.footer b {
  color: var(--kraft-500);
  font-weight: 600;
}

/* ---------- botões ---------- */

.btn {
  --btn-bg: var(--navy-800);
  --btn-fg: var(--cream);
  --btn-edge: var(--navy-1000);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 60px;
  margin: 0;
  padding: 0 26px;
  border: 0;
  border-radius: 22px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: 700 20px/1.1 var(--font-body);
  text-align: center;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--btn-edge), 0 14px 24px rgba(0, 0, 0, 0.28);
  transition: transform 0.12s var(--ease-out), box-shadow 0.12s var(--ease-out), filter 0.2s, opacity 0.2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  appearance: none;
  -webkit-appearance: none;
}

.btn .icon {
  width: 1.2em;
  height: 1.2em;
}

.btn:active:not(:disabled):not([aria-disabled='true']) {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--btn-edge), 0 6px 12px rgba(0, 0, 0, 0.28);
}

.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.4;
  cursor: not-allowed;
  filter: saturate(0.4);
}

.btn--primary {
  --btn-bg: linear-gradient(180deg, var(--gold-300) 0%, var(--gold-400) 46%, var(--gold-500) 100%);
  --btn-fg: var(--ink-900);
  --btn-edge: var(--gold-700);
  font-family: var(--font-display);
  font-weight: 800;
  box-shadow: 0 7px 0 var(--btn-edge), 0 18px 30px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.55);
}

.btn--primary:active:not(:disabled):not([aria-disabled='true']) {
  box-shadow: 0 2px 0 var(--btn-edge), 0 8px 16px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.4);
}

.btn--ghost {
  --btn-bg: rgba(211, 167, 107, 0.1);
  --btn-fg: var(--kraft-300);
  --btn-edge: rgba(0, 0, 0, 0.35);
  outline: 3px dashed rgba(227, 192, 139, 0.6);
  outline-offset: -3px;
}

.btn--ghost:focus-visible {
  outline-style: solid;
  outline-color: var(--teal-400);
}

.btn--small {
  min-height: 56px;
  padding: 0 22px;
  font-size: 18px;
  border-radius: 18px;
  border: 2px solid var(--navy-700);
}

.btn--danger {
  --btn-bg: rgba(226, 103, 74, 0.12);
  --btn-fg: var(--coral-300);
  --btn-edge: rgba(0, 0, 0, 0.3);
  border-color: rgba(226, 103, 74, 0.5);
}

.btn--ink {
  --btn-bg: var(--ink-900);
  --btn-fg: var(--paper-50);
  --btn-edge: #000;
  border: 0;
}

.btn--paper {
  --btn-bg: var(--paper-300);
  --btn-fg: var(--ink-900);
  --btn-edge: var(--kraft-500);
  border: 0;
}

/* ---------- avisos ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(92vw, 560px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  padding: 14px 22px;
  border: 2px solid var(--gold-500);
  border-radius: 999px;
  background: var(--navy-900);
  color: var(--cream);
  font: 600 17px/1.3 var(--font-body);
  box-shadow: var(--shadow-lift);
  animation: toast-in 0.4s var(--ease-spring) both;
}

.toast[data-tone='warn'] {
  border-color: var(--coral-500);
}

.toast.is-leaving {
  animation: toast-out 0.3s ease-in both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.94);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
}

/* ---------- troca de aba ---------- */

.view {
  animation: view-in 0.4s var(--ease-out) both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* ---------- telas menores ---------- */

@media (max-width: 880px) {
  .topbar {
    grid-template-columns: 1fr auto;
    row-gap: 16px;
    padding-top: 36px;
  }

  .tabs {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
  }

  .tab {
    flex: 1;
    justify-content: center;
    padding: 0 12px;
  }
}

@media (max-width: 520px) {
  .brand__mark {
    width: 46px;
    height: 46px;
  }

  .kicker {
    font-size: 10px;
    letter-spacing: 0.04em;
    white-space: nowrap;
  }

  .brand__title {
    font-size: 26px;
  }

  .tool {
    width: 50px;
    height: 50px;
  }
}
