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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
  min-height: 100vh;
  min-height: 100dvh;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 16px;
}

.hidden {
  display: none !important;
}

/* Auth Screen */
#auth-screen {
  justify-content: center;
  align-items: center;
  gap: 20px;
}

#auth-screen h1 {
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: #1d1d1f;
}

#password-input {
  width: 100%;
  max-width: 300px;
  padding: 16px;
  font-size: 18px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  background: #fff;
  color: #1d1d1f;
  text-align: center;
}

#auth-button {
  width: 100%;
  max-width: 300px;
  padding: 16px;
  font-size: 18px;
  border: none;
  border-radius: 8px;
  background: #007aff;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}

#auth-button:hover,
#auth-button:active {
  background: #0056b3;
}

/* Main Screen */
#main-screen {
  gap: 12px;
}

#text-input {
  flex: 1;
  width: 100%;
  padding: 16px;
  font-size: 24px;
  line-height: 1.6;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  background: #fff;
  color: #1d1d1f;
  resize: none;
}

#text-input::placeholder {
  color: #86868b;
}

#status {
  min-height: 24px;
  font-size: 14px;
  color: #86868b;
  text-align: center;
}

#status.error {
  color: #ff3b30;
}

#status.success {
  color: #34c759;
}

#status a {
  color: #007aff;
  text-decoration: underline;
}

#buttons {
  display: flex;
  gap: 12px;
}

.action-btn {
  flex: 1;
  padding: 18px;
  font-size: 20px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  background: #007aff;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.action-btn:hover,
.action-btn:active {
  background: #0056b3;
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.action-btn.loading {
  position: relative;
  color: transparent;
}

.action-btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
