
body {
  background: radial-gradient(ellipse 100% 80% at 50% 20%, #e2e7ed 70%, #d3d5dd 100%);
  margin: 0;
  padding: 0;
}

.device-frame {
  width: 375px;
  height: 812px;
  background: #1c1c1e;
  border-radius: 50px;
  border: 12px solid #1c1c1e;
  box-shadow: 0 10px 50px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.15);
  margin: 30px auto;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

/* Toast notification - highest z-index, contained within device frame */
#success-toast {
  position: absolute !important;
  z-index: 99999 !important;
  top: 5rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 3rem);
  width: auto;
  min-width: 200px;
  max-width: 320px;
  white-space: normal;
  word-wrap: break-word;
  pointer-events: none;
  box-sizing: border-box;
  overflow: hidden;
}

#success-toast:not(.hidden) {
  pointer-events: auto;
  display: flex !important;
}

#success-toast > div {
  width: 100%;
  flex-wrap: wrap;
}

/* Ensure modals don't overflow device frame - positioned relative to device frame */
.device-frame .modal {
  z-index: 100;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
  box-sizing: border-box;
  display: none;
}

.device-frame .modal.active {
  z-index: 100;
  display: flex !important;
}

/* Constrain modal content to device frame width */
.device-frame .modal > div {
  max-width: calc(100% - 2rem);
  max-height: calc(100% - 2rem);
  overflow-y: auto;
  margin: auto;
  box-sizing: border-box;
  position: relative;
}

/* Toast must be above everything */
#success-toast {
  z-index: 99999 !important;
}

.notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 30px;
  background: #1c1c1e;
  border-radius: 0 0 20px 20px;
  z-index: 100;
}

.inner-screen {
  width: 100%;
  height: 100%;
  background: #f5f5f7;
  position: relative;
  display: flex;
  flex-direction: column;
}

.glass {
  backdrop-filter: blur(20px) saturate(180%);
  background: rgba(255,255,255,0.88);
}

.page-view {
  display: none;
}

.page-view.active {
  display: block;
}

/* Chat detail page needs flex layout */
#chat-detail.active {
  display: flex !important;
  height: 100%;
  max-height: calc(100vh - 60px); /* Account for bottom nav */
}

.modal {
  display: none;
  z-index: 100;
}

.modal.active {
  display: flex;
  z-index: 100;
}

.nav-item.active {
  color: #007AFF;
}

*::-webkit-scrollbar {
  display: none;
}

* {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.status-bar {
  height: 44px;
  background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.88) 100%);
  backdrop-filter: blur(10px);
}

/* Splash Screen Styles */
.splash-screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #003366;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.5s ease-out;
}

.splash-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.app-title {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: bold;
  font-size: 50px;
  color: white;
  letter-spacing: -1px;
  margin-bottom: 20px;
}

.app-title .letter {
  display: inline-block;
  transition: all 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.app-title.separated .m {
  transform: translateX(-30px);
}

.app-title.separated .i1 {
  transform: translateX(-20px);
}

.app-title.separated .s1 {
  transform: translateX(-10px);
}

.app-title.separated .s2 {
  transform: translateX(10px);
}

.app-title.separated .e {
  transform: translateX(20px);
}

.app-title.separated .d {
  transform: translateX(30px);
}

.author-text {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 500;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: -10px;
  letter-spacing: 2px;
}

.tc-logo {
  position: absolute;
  bottom: 120px;
  width: 70px;
  height: 70px;
}

/* Login Styles */
.login-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #003366;
  z-index: 998;
  display: none;
  transition: opacity 0.5s ease-out;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  max-height: 100%;
}

.login-container.active {
  display: flex;
}

.login-container.fade-out {
  opacity: 0;
  pointer-events: none;
}

.login-container > div {
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 3rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  box-sizing: border-box;
  position: relative;
}

/* TC Logo positioning removed - now using flexbox layout */

/* iOS-style input improvements */
.login-container input {
  -webkit-appearance: none;
  appearance: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.login-container input:focus {
  background-color: #ffffff;
}

.login-container input::placeholder {
  color: #9ca3af;
  opacity: 1;
}

/* Onboarding Styles */
.onboarding-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fafafa;
  z-index: 999;
  display: none;
  transition: opacity 0.5s ease-out;
}

.onboarding-container.active {
  display: block;
}

.onboarding-container.fade-out {
  opacity: 0;
  pointer-events: none;
}

.onboarding-screen {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  animation: fadeIn 0.5s ease-out;
}

.onboarding-screen.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Animation utilities */
.error-shake {
  animation: shake 0.5s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.success-pulse {
  animation: pulse 0.5s;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Toast notifications */
#success-toast {
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    transform: translate(-50%, -100%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

/* Link styling to prevent overflow */
.link-text {
  word-wrap: break-word;
  word-break: break-all;
  overflow-wrap: break-word;
  max-width: 100%;
  display: block;
}

.comment {
  background: #fff;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.comment-header {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  align-items: center;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #3b82f6;
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.comment-text {
  font-size: 14px;
  color: #333;
  margin-bottom: 8px;
}

.comment-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.reaction-btn {
  font-size: 18px;
  background: none;
  border: none;
  cursor: pointer;
}

.votes button {
  background: #f3f4f6;
  border: none;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.reply-box {
  margin-top: 8px;
}

.reply-input {
  width: 100%;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid #ccc;
  margin-bottom: 4px;
}

.hidden {
  display: none;
}

.reply-list {
  margin-top: 10px;
  margin-left: 20px;
}

.reply {
  background: #f9fafb;
  padding: 8px;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}