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

/* Ensure [hidden] always wins over component display rules */
[hidden] {
  display: none !important;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.985);
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out), visibility 220ms;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

img {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font-size: inherit;
  touch-action: manipulation;
}

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

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 2rem;
  background: var(--accent);
  color: var(--btn-text);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-full);
  transition: transform 120ms var(--ease-spring-subtle), background-color 150ms var(--ease-out);
  width: 100%;
  max-width: 320px;
}

.btn-primary:active {
  transform: scale(0.965);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 2rem;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  transition: transform 120ms var(--ease-spring-subtle), background-color 150ms var(--ease-out);
  width: 100%;
  max-width: 320px;
}

.btn-secondary:active {
  transform: scale(0.965);
}

.btn-secondary:hover {
  background: var(--surface-hover);
}

.btn-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: transform 120ms var(--ease-spring-subtle), background-color 150ms var(--ease-out), border-color 150ms var(--ease-out);
}

.btn-back:active {
  transform: scale(0.92);
}

.btn-back:hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-primary);
}

.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.screen-header h2 {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.header-spacer {
  width: 44px;
}
