/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  background: #f0ec57;
  color: #000;
  font-family: Arial, sans-serif;
  font-weight: bold;
  -webkit-font-smoothing: antialiased;
}

/* ===== Home Page Layout ===== */
.home {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.phrase {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 1.2;
  color: #000;
  text-decoration: none;
}

.phrase-static {
  white-space: nowrap;
  padding-right: 0.3em;
  width: 50vw;
  text-align: right;
  font-family: 'Courier New', Courier, monospace;
}

/* ===== Scribble ===== */
.scribble {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  vertical-align: middle;
  margin-right: 0.1em;
  position: relative;
  top: -0.08em;
}

.scribble canvas {
  width: 100%;
  height: 100%;
}

/* ===== Rolodex Container ===== */
.rolodex-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 50vw;
}

.rolodex {
  position: relative;
  height: 500px;
  width: 450px;
  perspective: 600px;
  overflow: hidden;
  touch-action: none;
}

.rolodex-item {
  position: absolute;
  left: 0;
  right: 0;
  text-align: left;
  white-space: nowrap;
  pointer-events: none;
  will-change: transform, opacity;
  transition: none;
  top: 50%;
  margin-top: -0.6em;
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 1.2;
}

/* ===== Hint ===== */
.hint {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  font-weight: normal;
  opacity: 0.5;
  transition: opacity 0.4s ease;
  white-space: nowrap;
}

.hint.hidden {
  opacity: 0;
  pointer-events: none;
}

.hint kbd {
  display: inline-block;
  padding: 0.1em 0.4em;
  border: 1px solid #000;
  border-radius: 3px;
  font-family: Arial, sans-serif;
  font-size: 0.8rem;
  vertical-align: baseline;
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
  .home {
    justify-content: center;
    align-items: center;
  }

  .phrase {
    flex-direction: column;
    align-items: center;
    text-align: center;
    font-size: clamp(3rem, 12vw, 5rem);
  }

  .scribble {
    display: block;
    width: 1.5em;
    height: 1.5em;
    margin: 0 auto 0.1em;
  }

  .phrase-static {
    width: auto;
    text-align: center;
    padding-right: 0;
    padding-bottom: 0.1em;
  }

  .rolodex-item {
    font-size: clamp(3rem, 12vw, 5rem);
  }

  .rolodex-wrapper {
    width: auto;
    align-items: center;
  }

  .rolodex {
    width: 80vw;
    height: 200px;
    overflow: hidden;
  }

  .rolodex-item {
    text-align: center;
    top: 0;
    margin-top: 0;
  }
}

/* ===== Ocean ===== */
#ocean-canvas {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 20vh;
  z-index: 10;
  pointer-events: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ===== Sub-pages ===== */
.subpage {
  min-height: 100vh;
  padding: 3rem;
  font-family: 'Courier New', Courier, monospace;
}

.subpage header {
  margin-bottom: 2.5rem;
}

.subpage .back-link {
  color: #000;
  text-decoration: none;
  font-size: 1rem;
}

.subpage .back-link:hover {
  text-decoration: underline;
}

.subpage main h1 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
}

.subpage main p {
  font-weight: normal;
  font-size: 1.1rem;
  max-width: 600px;
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  .rolodex-item {
    transition: none !important;
  }
}
