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

[hidden] {
  display: none !important;
}

html, body {
  height: 100%;
  background: #ffffff;
  color: #111111;
  overscroll-behavior-x: none;
}

body {
  font-family: Georgia, 'Times New Roman', serif;
  -webkit-tap-highlight-color: transparent;
}

#authScreen {
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-box {
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.auth-box h1 {
  font-size: 1.3rem;
  font-weight: normal;
  margin-bottom: 2rem;
  letter-spacing: 0.02em;
}

#emailInput,
#passwordInput {
  width: 100%;
  border: none;
  border-bottom: 1px solid #cccccc;
  outline: none;
  background: transparent;
  color: #111111;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem 0.2rem;
  text-align: center;
  margin-top: 0.8rem;
}

#emailInput::placeholder,
#passwordInput::placeholder {
  color: #bbbbbb;
}

.auth-buttons {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.4rem;
}

#loginBtn,
#signupBtn {
  flex: 1;
  border: none;
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  padding: 0.6rem 1rem;
  border-radius: 2px;
  cursor: pointer;
}

#loginBtn {
  background: #111111;
  color: #ffffff;
}

#signupBtn.auth-secondary {
  background: transparent;
  color: #111111;
  border: 1px solid #cccccc;
}

#loginBtn:disabled,
#signupBtn:disabled {
  opacity: 0.5;
  cursor: default;
}

#authMessage {
  margin-top: 1.2rem;
  font-family: system-ui, sans-serif;
  font-size: 0.8rem;
  color: #999999;
  min-height: 1.2em;
}

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

.logout-link {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 0.6rem);
  right: 0.9rem;
  z-index: 6;
  background: none;
  border: none;
  font-family: system-ui, sans-serif;
  font-size: 0.7rem;
  color: #cccccc;
  cursor: pointer;
  padding: 0.4rem;
}

.logout-link:hover {
  color: #888888;
}

#page {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 2.2rem 1.4rem 1rem;
  min-height: 0;
  touch-action: pan-y;
}

#page.sliding {
  animation: dayShift 0.22s ease;
}

@keyframes dayShift {
  from { opacity: 0; transform: translateX(var(--shift, 14px)); }
  to   { opacity: 1; transform: translateX(0); }
}

#dateHeader {
  text-align: center;
  margin-bottom: 1.6rem;
}

#dateText {
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  text-transform: capitalize;
  color: #111111;
}

#saveStatus {
  display: none;
  font-family: system-ui, sans-serif;
  font-size: 0.75rem;
  color: #c0392b;
  text-align: center;
  padding: 0.6rem 0;
}

#saveStatus.visible {
  display: block;
}

#entry {
  flex: 1;
  width: 100%;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: #111111;
  font-family: inherit;
  font-size: 1.1rem;
  line-height: 1.6;
  min-height: 0;
}

#entry::placeholder {
  color: #bbbbbb;
}

#entry:disabled {
  display: none;
}

#futureLock {
  display: none;
  flex: 1;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #bbbbbb;
  font-size: 1rem;
}

#page.is-future #futureLock {
  display: flex;
}

.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: #cccccc;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  transition: color 0.15s ease;
}

.nav-arrow:hover {
  color: #888888;
}

.nav-arrow:disabled {
  color: #eeeeee;
  cursor: default;
}

.nav-arrow--left {
  left: 0.1rem;
}

.nav-arrow--right {
  right: 0.1rem;
}

#hint {
  text-align: center;
  font-size: 0.7rem;
  color: #cccccc;
  padding: 0.6rem 0 1rem;
  font-family: system-ui, sans-serif;
  letter-spacing: 0.02em;
}

@media (min-width: 720px) {
  #page {
    max-width: 640px;
    margin: 0 auto;
    padding-top: 4rem;
  }

  #dateText {
    font-size: 1.2rem;
  }

  #entry {
    font-size: 1.15rem;
  }

  .nav-arrow {
    font-size: 2rem;
    padding: 0.8rem 1.2rem;
  }
}
