:root {
  --shell-bg: #0b5953;
  --shell-accent: #00796d;
  --ticket-main: #00796d;
  --ticket-secondary: #35bdb2;
  --ticket-bg: #d7eff1;
  --ticket-text: #004c43;
  --ticket-red: #c80000;
  --screen-bg: #f3f5f7;
  --panel-bg: #ffffff;
  --panel-border: rgba(0, 76, 67, 0.12);
  --panel-shadow: 0 18px 44px rgba(0, 0, 0, 0.14);
  --bottom-nav-height: 4.15rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(53, 189, 178, 0.22), transparent 28rem),
    linear-gradient(180deg, #eef4f4, #d8e5e4);
  color: #0a2421;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: #fff;
  padding: 0;
  min-height: 100%;
  min-height: -webkit-fill-available;
}

.app-shell {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #fff;
}

.app-header {
  position: relative;
  z-index: 20;
  background: var(--shell-accent);
  color: #fff;
  display: grid;
  grid-template-columns: 3rem 1fr 3rem;
  align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 0.7rem) 0.45rem 0.85rem;
}

.back-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
}

.back-button svg {
  width: 2rem;
  height: 2rem;
  fill: currentColor;
}

.app-header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}

.app-header h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.demo-pill {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.55rem;
}

.controls-card,
.ticket-screen {
  margin: 0 auto;
  width: 100%;
}

.app-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  padding: 0;
}

body.ticket-mode .app-content {
  overflow: hidden;
}

.controls-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  border-radius: 1.2rem;
  margin: 0.9rem 1rem 1.2rem;
  padding: 1.1rem;
}

.controls-card h2 {
  margin: 0 0 0.4rem;
  color: var(--ticket-text);
  font-size: 1.15rem;
}

.controls-card p {
  margin: 0 0 1rem;
  color: rgba(10, 36, 33, 0.72);
  line-height: 1.45;
}

.ticket-form {
  display: grid;
  gap: 0.85rem;
}

.ticket-form label {
  display: grid;
  gap: 0.38rem;
}

.ticket-form span {
  font-weight: 600;
  color: var(--ticket-text);
}

.ticket-form input {
  width: 100%;
  border: 1px solid rgba(0, 76, 67, 0.16);
  border-radius: 0.9rem;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  background: #f9fbfb;
}

.ticket-form select {
  width: 100%;
  border: 1px solid rgba(0, 76, 67, 0.16);
  border-radius: 0.9rem;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  color: #0a2421;
  background: #f9fbfb;
}

.ticket-form input:focus,
.ticket-form select:focus {
  outline: 2px solid rgba(0, 121, 109, 0.25);
  border-color: var(--ticket-main);
}

.ticket-form [hidden] {
  display: none;
}

.primary-button,
.primary-button {
  appearance: none;
  border: 0;
  border-radius: 1rem;
  font: inherit;
  font-weight: 700;
  padding: 0.95rem 1rem;
  background: var(--ticket-main);
  color: #fff;
}

.hidden {
  display: none;
}

.ticket-screen {
  background: #fff;
  margin-top: 0;
}

body.ticket-mode .ticket-screen {
  display: flex;
  min-height: 100%;
}

#ticketMount {
  width: 100%;
}

body.ticket-mode #ticketMount {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}

.ticket-frame {
  width: 100%;
  border: 0;
  display: block;
  background: #fff;
  min-height: 70vh;
}

body.ticket-mode .ticket-frame {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.bottom-nav {
  position: relative;
  flex: 0 0 auto;
  z-index: 20;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(18px);
  padding: 0 0 env(safe-area-inset-bottom, 0px);
}

.bottom-nav-inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: start;
  min-height: var(--bottom-nav-height);
  padding: 0 0 0.45rem;
  transform: translateY(-0.05rem);
}

.nav-item {
  color: #585858;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: var(--bottom-nav-height);
  gap: 0.06rem;
  font-size: 0.74rem;
  line-height: 1.1;
  padding-top: 0;
}


.nav-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.nav-icon-svg {
  width: 1.36rem;
  height: 1.36rem;
  display: block;
}

.nav-item.active {
  color: var(--ticket-main);
  font-weight: 700;
}

.nav-item.active .nav-icon {
  background: transparent;
}

@media (min-width: 768px) {
  body {
    display: flex;
    justify-content: center;
    padding: 0;
    background:
      radial-gradient(circle at top, rgba(53, 189, 178, 0.18), transparent 28rem),
      linear-gradient(180deg, #eef4f4, #d8e5e4);
  }

  .app-shell {
    left: 50%;
    width: min(100vw, 430px);
    height: min(100dvh, 100vh);
    transform: translateX(-50%);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0 24px 60px rgba(0, 0, 0, 0.14);
  }
}

@media all and (display-mode: standalone) {
  .app-shell {
    height: 100vh;
  }
}
