* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f3f3f3;
  color: #111;
}

button,
textarea {
  font: inherit;
}

.screen {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  background: white;
}

.hidden {
  display: none !important;
}

/* SHARED: dark pixel-logo screens (INPUT / GENERATING) */

.pixel-screen {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(64px, 15vw, 156px) clamp(16px, 4vw, 20px) clamp(2px, 1vw, 8px);
  background: linear-gradient(to bottom, #000000 0%, #eeeeee 100%);
}

.screen-heading {
  margin: 0;
  width: 100%;
  max-width: clamp(280px, 44vw, 560px);
  text-align: center;
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: clamp(22px, 3.9vw, 44px);
  letter-spacing: -0.06em;
  color: rgba(255, 255, 255, 0.7);
}

.screen-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100% + 2 * clamp(16px, 4vw, 20px));
  margin: 0 calc(-1 * clamp(16px, 4vw, 20px));
  padding: clamp(8px, 2vw, 25px) clamp(4px, 1vw, 18px);
}

.screen-bg-logo {
  display: block;
  width: 100%;
  aspect-ratio: 2602 / 862;
  overflow: visible;
}

/* 마우스가 가까이 오면 그 근처 픽셀만 커지면서 벌어지고, 멀어지면 부드럽게 제자리로 */
.screen-bg-logo rect,
.screen-bg-logo path {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.25s ease-out;
}

/* INPUT */

.input-screen {
  gap: clamp(32px, 7vw, 74px);
}

.input-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 2.6vw, 27px);
  width: 100%;
}

.input-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1vw, 10px);
  width: 100%;
  max-width: clamp(320px, 46vw, 560px);
}

.input-pill {
  flex: 1 1 0;
  min-width: 0;
  height: clamp(46px, 5.8vw, 66px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.input-pill input {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0 clamp(16px, 2.4vw, 24px);
  border: 0;
  outline: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-weight: 500;
  font-size: clamp(13px, 1.7vw, 20px);
  letter-spacing: -0.06em;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.input-pill input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.go-pill {
  flex: 0 0 auto;
  min-width: clamp(56px, 7vw, 78px);
  height: clamp(46px, 5.8vw, 66px);
  padding: 0 clamp(14px, 2vw, 20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.7);
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-weight: 500;
  font-size: clamp(13px, 1.7vw, 20px);
  letter-spacing: -0.06em;
  cursor: pointer;
}

/* GENERATING */

.generating-screen {
  gap: clamp(64px, 16vw, 154px);
}

/* RESULT */

.result-screen {
  position: relative;
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  background: linear-gradient(to right, #000000 0%, #eeeeee 100%);
}

.result-sidebar {
  flex: 0 0 clamp(300px, 32.7vw, 471px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(18px, 2.6vw, 37px);
  padding: clamp(16px, 2vw, 26px) clamp(18px, 2.4vw, 32px);
}

.result-canvas {
  flex: 1 1 0;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4vw, 40px);
  background: #000;
}

button:hover:not(:disabled) {
  opacity: 0.75;
}

/* Result heading — shows the emotion text the user typed */

.result-heading {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.result-title {
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 30px;
  line-height: 1.3;
  color: #ffffff;
  word-break: break-word;
  cursor: text;
}

.result-title-input {
  width: 100%;
  border: 0;
  outline: none;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 30px;
  line-height: 1.3;
}

.result-subtitle {
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-weight: 500;
  font-size: 20px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.7);
  word-break: break-word;
  cursor: text;
}

.result-subtitle.is-placeholder {
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
}

.result-subtitle-input {
  width: 100%;
  border: 0;
  outline: none;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-weight: 500;
  font-size: 20px;
  line-height: 1.4;
}

/* Nav / play / reset / save pill buttons */

.nav-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: clamp(8px, 1.4vw, 14px);
  width: 100%;
}

.pill-btn {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(14px, 2vw, 25px) clamp(8px, 1vw, 10px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 40px;
  background: rgba(255, 255, 255, 0.07);
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-weight: 500;
  font-size: clamp(13px, 1.6vw, 20px);
  letter-spacing: -0.08em;
  color: #8b8b8b;
  cursor: pointer;
}

.pill-btn:disabled {
  color: rgba(139, 139, 139, 0.4);
  cursor: default;
}

.icon-pill img {
  width: clamp(16px, 2vw, 22px);
  height: auto;
  display: block;
}

.pause-bars {
  display: flex;
  gap: 3px;
}

.pause-bars span {
  width: clamp(8px, 1vw, 11px);
  height: clamp(24px, 3vw, 34px);
  border-radius: 2px;
  background: #616161;
}

.pill-btn:disabled .pause-bars span {
  background: rgba(97, 97, 97, 0.4);
}

/* Slider card */

.slider-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 2.4vw, 28px);
  padding: clamp(20px, 3vw, 38px) clamp(16px, 2.4vw, 28px);
  border-radius: 35px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.slider-row {
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 0.8vw, 8px);
}

.control-name {
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-weight: 500;
  font-size: clamp(12px, 1.4vw, 18px);
  letter-spacing: -0.07em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.slider-track-row {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.2vw, 14px);
}

.slider-track {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.slider-track input[type="range"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  height: clamp(16px, 2vw, 22px);
  margin: 0;
  border-radius: 38px;
  outline: none;
  cursor: pointer;
  background: linear-gradient(
    to right,
    #616161 0%,
    #616161 var(--fill, 50%),
    rgba(255, 255, 255, 0.07) var(--fill, 50%),
    rgba(255, 255, 255, 0.07) 100%
  );
}

.slider-track input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: clamp(10px, 1.1vw, 12px);
  height: clamp(20px, 2.6vw, 28px);
  border-radius: 38px;
  background: #616161;
  cursor: pointer;
}

.slider-track input[type="range"]::-moz-range-thumb {
  width: clamp(10px, 1.1vw, 12px);
  height: clamp(20px, 2.6vw, 28px);
  border: 0;
  border-radius: 38px;
  background: #616161;
  cursor: pointer;
}

.slider-track input[type="range"]::-moz-range-track {
  height: clamp(16px, 2vw, 22px);
  border-radius: 38px;
  background: transparent;
}

.control-value {
  flex: 0 0 auto;
  min-width: 25px;
  text-align: right;
  font-family: "IBM Plex Sans", Arial, Helvetica, sans-serif;
  font-weight: 500;
  font-size: clamp(13px, 1.5vw, 20px);
  letter-spacing: -0.04em;
  color: rgba(255, 255, 255, 0.7);
  pointer-events: none;
}

/* MY LIST */

.mylist-screen {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 3.6vw, 38px);
  padding: clamp(16px, 2vw, 20px) clamp(18px, 2.4vw, 25px) clamp(18px, 2.4vw, 24px)
    clamp(20px, 3vw, 32px);
  background: linear-gradient(to top, #656565 0%, #d2d2d2 100%);
}

.mylist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.mylist-brand {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.6vw, 16px);
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

.mylist-logo {
  height: clamp(36px, 5vw, 60px);
  width: auto;
  display: block;
}

.mylist-brand span {
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: clamp(16px, 2vw, 24px);
  letter-spacing: -0.02em;
  color: #787878;
}

.mylist-count {
  flex: 0 0 auto;
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: clamp(14px, 1.7vw, 20px);
  letter-spacing: -0.02em;
  color: #787878;
}

.list-box {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2.4vw, 39px);
  width: 100%;
  overflow-y: auto;
}

.list-item {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 32px);
  width: 100%;
  min-height: clamp(88px, 12vw, 129px);
  padding: clamp(14px, 1.6vw, 18px) clamp(20px, 2.6vw, 32px);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.4);
  cursor: pointer;
}

.list-date {
  flex: 0 0 auto;
  width: clamp(56px, 5.5vw, 80px);
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: clamp(13px, 1.3vw, 18px);
  letter-spacing: -0.02em;
  color: #333333;
}

.list-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.list-title {
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: clamp(13px, 1.3vw, 18px);
  letter-spacing: -0.02em;
  color: #333333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
}

.list-title-input {
  width: 100%;
  max-width: 300px;
  border: 0;
  outline: none;
  background: rgba(255, 255, 255, 0.85);
  color: #1a1a1a;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: clamp(13px, 1.3vw, 18px);
  letter-spacing: -0.02em;
}

.list-quote {
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: clamp(12px, 1.2vw, 18px);
  letter-spacing: -0.02em;
  color: #333333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-tags {
  flex: 0 0 auto;
  width: clamp(160px, 20vw, 250px);
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: clamp(12px, 1.2vw, 18px);
  letter-spacing: -0.02em;
  color: #333333;
}

.list-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 12px);
}

.list-play-btn,
.list-delete-btn {
  flex: 0 0 auto;
  width: clamp(56px, 5.5vw, 76px);
  height: clamp(38px, 3.8vw, 51px);
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.list-play-btn img,
.list-delete-btn img {
  width: clamp(14px, 1.6vw, 20px);
  height: auto;
  display: block;
}

.mylist-empty {
  margin: 0;
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-weight: 500;
  font-size: clamp(14px, 1.6vw, 18px);
  color: #555555;
}

@media (max-width: 700px) {
  .input-row {
    flex-direction: column;
  }

  .input-pill {
    width: 100%;
  }

  .input-pill input {
    text-align: center;
  }

  .go-pill {
    width: 100%;
  }

  .result-screen {
    flex-direction: column;
  }

  .result-sidebar {
    flex: none;
    width: 100%;
    min-height: 0;
  }

  .result-canvas {
    min-height: 60vh;
  }

  .list-item {
    flex-wrap: wrap;
  }

  .list-main {
    order: 1;
    flex: 1 1 100%;
  }

  .list-date {
    order: 0;
  }

  .list-tags {
    order: 2;
    width: auto;
  }

  .list-actions {
    order: 3;
    margin-left: auto;
  }
}

#visual-container {
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 커질 때 빰-빰-빰(3단계), 작아질 때도 빰-빰-빰(3단계)으로,
   각 박자마다 짧게 순간적으로 스냅하고 그 사이는 확실히 멈춰서 시간차가 느껴지도록 한다.
   (전체가 깜빡이는 효과는 제거, 크기 스냅만 남김) */
@keyframes breathe {
  0% {
    transform: scale(1);
  }
  1.5% {
    transform: scale(var(--breathe-scale-1, 1.02));
  }
  16.67% {
    transform: scale(var(--breathe-scale-1, 1.02));
  }
  18.17% {
    transform: scale(var(--breathe-scale-2, 1.04));
  }
  33.33% {
    transform: scale(var(--breathe-scale-2, 1.04));
  }
  34.83% {
    transform: scale(var(--breathe-scale, 1.05));
  }
  50% {
    transform: scale(var(--breathe-scale, 1.05));
  }
  51.5% {
    transform: scale(var(--breathe-scale-2, 1.04));
  }
  66.67% {
    transform: scale(var(--breathe-scale-2, 1.04));
  }
  68.17% {
    transform: scale(var(--breathe-scale-1, 1.02));
  }
  83.33% {
    transform: scale(var(--breathe-scale-1, 1.02));
  }
  84.83%,
  100% {
    transform: scale(1);
  }
}

#visual-container canvas {
  display: block;
}
#visual-container svg {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: center;
  animation-name: breathe;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  animation-duration: var(--breathe-duration, 0.4s);
}

/* Play/Stop과 연동되는 그래픽 모션 일시정지. animation-play-state는 멈춘 프레임을 그대로
   유지하므로, 클래스를 떼서 다시 running으로 돌리면 멈췄던 위치에서 정확히 이어진다. */
#visual-container.motion-paused svg,
#visual-container.motion-paused .scatter-blink {
  animation-play-state: paused;
}

#visual-container svg rect,
#visual-container svg path {
  transform-box: fill-box;
  transform-origin: center;
}

/* 흩어지는(테두리) 픽셀들이 나타났다 사라졌다 깜빡거리는 효과 (서서히 페이드 없이 딱딱 전환) */
@keyframes scatter-blink {
  0%,
  49.9% {
    opacity: 1;
  }
  50%,
  99.9% {
    opacity: var(--blink-min-opacity, 0);
  }
  100% {
    opacity: 1;
  }
}

#visual-container svg .scatter-blink {
  animation: scatter-blink 3s step-end infinite;
}
