.hidden,
[hidden] {
  display: none !important;
}

#website,
input[name="website"] {
  position: fixed !important;
  left: -9999px !important;
  top: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.waiting-game,
.snake-board,
.snake-controls,
.merge-lanes,
.bubble-field,
.bubble-controls,
.next-star,
.game-panel {
  display: none !important;
}

@media (max-width: 900px) {
  :root {
    color-scheme: light;
    --m-bg: #fff8f4;
    --m-panel: rgba(255, 254, 252, 0.96);
    --m-ink: #352927;
    --m-muted: #826f69;
    --m-line: rgba(226, 202, 194, 0.72);
    --m-accent: #c85c74;
    --m-accent-2: #8f7bd5;
  }

  * {
    box-sizing: border-box;
  }

  html {
    width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
  }

  body {
    width: 100%;
    margin: 0;
    overflow-x: hidden;
    background:
      radial-gradient(circle at 12% 0%, rgba(255, 218, 206, 0.65), transparent 34%),
      linear-gradient(135deg, #fff4ef 0%, #fffdf8 54%, #f7fff9 100%);
    color: var(--m-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  }

  button,
  input,
  select,
  textarea {
    max-width: 100%;
    font: inherit;
  }

  button {
    border: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .page {
    width: 100%;
    min-height: 100svh;
  }

  .hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
    min-height: auto;
    padding: max(18px, env(safe-area-inset-top)) 14px 34px;
  }

  .hero-copy {
    display: grid;
    gap: 14px;
    padding: 2px 2px 0;
  }

  .eyebrow {
    margin: 0;
    color: #a83f59;
    font-size: 14px;
    font-weight: 850;
    line-height: 1.5;
  }

  .hero-copy h1 {
    margin: 0;
    color: #2f2422;
    font-size: clamp(42px, 12vw, 58px);
    line-height: 1.02;
    letter-spacing: 0;
  }

  .lead {
    margin: 0;
    color: var(--m-muted);
    font-size: 17px;
    line-height: 1.82;
  }

  .quick-tags,
  .mood-grid,
  .emotion-grid,
  .empathy-tray,
  .chat-actions,
  .matching-notes,
  .quiet-path-grid,
  .article-scenes {
    grid-template-columns: 1fr;
  }

  .quick-tags span,
  .mood-chip,
  .empathy-tray button,
  .matching-notes span,
  .quiet-path-grid a {
    min-width: 0;
    border: 1px solid var(--m-line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
    color: #9f3f58;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
  }

  .quick-tags span {
    padding: 9px 12px;
  }

  .chat-sample {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    margin-top: 6px;
  }

  .avatar-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .avatar-preview {
    width: 42px;
    height: 42px;
  }

  .avatar-card button {
    min-height: 38px;
  }

  .sample-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background:
      radial-gradient(circle at 62% 32%, #fff 0 12%, transparent 13%),
      linear-gradient(135deg, #ffac98, #f2c069);
    box-shadow: 0 14px 28px rgba(200, 92, 116, 0.2);
  }

  .sample-bubble {
    width: fit-content;
    max-width: 100%;
    padding: 11px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.94);
    color: #5f4d48;
    font-size: 15px;
    line-height: 1.45;
    box-shadow: 0 14px 28px rgba(83, 58, 51, 0.08);
  }

  .sample-bubble.reply {
    grid-column: 2;
    background: #fff0f3;
    color: #9f3f58;
  }

  .chat-panel {
    width: 100%;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--m-line);
    border-radius: 24px;
    background: var(--m-panel);
    box-shadow: 0 24px 56px rgba(96, 66, 58, 0.13);
  }

  .panel-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--m-line);
    background: linear-gradient(90deg, rgba(255, 239, 244, 0.86), rgba(247, 255, 250, 0.88));
  }

  .panel-top span,
  .panel-top small {
    color: #a55f6f;
    font-size: 12px;
    font-weight: 800;
  }

  .panel-top strong {
    display: block;
    margin-top: 3px;
    color: #3d2c2a;
    font-size: 19px;
    line-height: 1.2;
  }

  .setup {
    display: grid;
    gap: 14px;
    padding: 14px;
  }

  .lobby-mood-strip {
    display: grid;
    gap: 3px;
    padding: 10px 12px;
    border: 1px solid rgba(226, 202, 194, 0.58);
    border-radius: 16px;
    background: rgba(255, 250, 247, 0.82);
  }

  .lobby-mood-strip span {
    color: #5a403d;
    font-weight: 900;
  }

  .lobby-mood-strip small,
  .emotion-checkin span,
  .soft-note {
    color: var(--m-muted);
    font-size: 13px;
    line-height: 1.55;
  }

  .emotion-checkin {
    display: grid;
    gap: 9px;
  }

  .mood-chip,
  .empathy-tray button {
    min-height: 42px;
    padding: 10px 13px;
  }

  .mood-chip.active {
    background: linear-gradient(135deg, #d05f79, #9a7bdf);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 14px 28px rgba(200, 92, 116, 0.2);
  }

  .pixel-lobby {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 0;
    overflow: hidden;
    border: 5px solid rgba(255, 238, 233, 0.96);
    border-radius: 20px;
    background: #2e181f;
    box-shadow: 0 20px 48px rgba(59, 34, 35, 0.18);
  }

  .pixel-lobby img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .lobby-actor {
    position: absolute;
    z-index: 2;
    width: 24px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: url("/assets/walker-rose.png") 0 0 / 96px 36px no-repeat;
    image-rendering: pixelated;
    filter: drop-shadow(0 5px 4px rgba(31, 20, 24, 0.2));
    transform: translate3d(0, 0, 0);
    --sprite-end: -96px;
  }

  .lobby-actor::before {
    display: none;
    content: "";
    position: absolute;
    left: 6px;
    top: 1px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffd0bd;
    box-shadow: 0 8px 0 #3e344b, -4px 15px 0 #d46582, 4px 15px 0 #6bb0a3, 0 20px 0 #384060;
  }

  .actor-one,
  .actor-five,
  .actor-nine {
    background-image: url("/assets/walker-rose.png");
  }

  .actor-two,
  .actor-seven {
    background-image: url("/assets/walker-mint.png");
  }

  .actor-three,
  .actor-eight {
    background-image: url("/assets/walker-honey.png");
  }

  .actor-four,
  .actor-six {
    background-image: url("/assets/walker-lilac.png");
  }

  .actor-one { left: 48%; top: 45%; }
  .actor-two { left: 58%; top: 53%; }
  .actor-three { left: 39%; top: 58%; }
  .actor-four { left: 31%; top: 66%; }
  .actor-five { left: 50%; top: 66%; }
  .actor-six { left: 68%; top: 58%; }
  .actor-seven { left: 24%; top: 53%; }
  .actor-eight { left: 75%; top: 67%; }
  .actor-nine { left: 62%; top: 42%; }

  .lobby-actor-bubble {
    position: absolute;
    z-index: 8;
    max-width: 120px;
    padding: 7px 9px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: #6f4e55;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.35;
    box-shadow: 0 10px 24px rgba(53, 41, 39, 0.18);
  }

  .primary,
  .matching-cancel,
  .composer button {
    min-height: 52px;
    padding: 13px 18px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--m-accent), var(--m-accent-2));
    color: #fff;
    font-size: 16px;
    font-weight: 950;
    box-shadow: 0 18px 36px rgba(200, 92, 116, 0.22);
  }

  .soft-note {
    margin: 0;
    text-align: center;
  }

  .chat {
    position: relative;
    display: grid;
    grid-template-rows: auto auto minmax(240px, 1fr) auto auto;
    min-height: min(720px, calc(100svh - 34px));
  }

  .chat.matching {
    display: block;
    min-height: min(720px, calc(100svh - 34px));
  }

  .matching-scene {
    position: relative;
    inset: auto;
    display: none;
    min-height: min(720px, calc(100svh - 34px));
    padding: 16px 12px 18px;
    overflow: visible;
    text-align: center;
    background:
      radial-gradient(circle at 50% 20%, rgba(255, 220, 177, 0.45), transparent 34%),
      linear-gradient(180deg, rgba(255, 250, 247, 0.98), rgba(255, 241, 235, 0.98));
  }

  .chat.matching .matching-scene {
    display: grid;
    align-content: start;
    justify-items: center;
    gap: 10px;
  }

  .matching-scene strong {
    max-width: 300px;
    color: #3b2928;
    font-size: 22px;
    line-height: 1.35;
  }

  .matching-scene p {
    max-width: 320px;
    margin: 0;
    color: var(--m-muted);
    font-size: 15px;
    line-height: 1.65;
  }

  .matching-progress {
    width: min(360px, 92%);
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(226, 202, 194, 0.78);
  }

  .matching-progress span {
    display: block;
    width: 34%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--m-accent), var(--m-accent-2));
    animation: mobileLobbyWait 1.6s ease-in-out infinite alternate;
  }

  .matching-scene .pixel-lobby {
    width: min(100%, 410px);
    margin: 0 auto;
  }

  .matching-cancel {
    width: min(410px, 100%);
    margin-top: 2px;
  }

  .matched-room {
    position: relative;
    height: 170px;
    margin: 12px;
    overflow: hidden;
    border: 4px solid rgba(255, 238, 233, 0.96);
    border-radius: 18px;
    background: #2e181f;
  }

  .matched-room img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .matched-room-note,
  .matched-room-actor,
  .matched-chat-bubble {
    position: absolute;
  }

  .matched-room-note {
    left: 12px;
    top: 10px;
    z-index: 3;
    padding: 6px 9px;
    border-radius: 999px;
    background: rgba(33, 22, 28, 0.62);
    color: rgba(255, 248, 239, 0.94);
    font-size: 12px;
    font-weight: 850;
  }

  .matched-room-actor {
    z-index: 2;
    width: 24px;
    height: 36px;
    background: url("/assets/walker-rose.png") 0 0 / 96px 36px no-repeat;
    filter: drop-shadow(0 7px 5px rgba(20, 12, 16, 0.28));
    image-rendering: pixelated;
    animation: actorSprite 0.9s steps(4, end) infinite;
  }

  .matched-room-actor.actor-a {
    left: 40%;
    top: auto;
    bottom: 24%;
    transform: scale(0.95);
  }

  .matched-room-actor.actor-b {
    left: 54%;
    top: auto;
    bottom: 25%;
    background-image: url("/assets/walker-mint.png");
    transform: scale(-0.92, 0.92);
  }

  .matched-chat-bubble {
    z-index: 4;
    top: 33%;
    padding: 6px 9px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.94);
    color: #6b4d53;
    font-size: 12px;
    font-weight: 800;
  }

  .bubble-a {
    left: 28%;
  }

  .bubble-b {
    right: 24%;
  }

  .chat-status {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid var(--m-line);
    border-bottom: 1px solid var(--m-line);
    background: rgba(255, 250, 247, 0.88);
  }

  .chat-status strong,
  .chat-status span {
    display: block;
  }

  .chat-status strong {
    color: #3d2c2a;
    font-size: 15px;
  }

  .chat-status span {
    margin-top: 3px;
    color: var(--m-muted);
    font-size: 12px;
    line-height: 1.45;
  }

  .chat.is-matched .matched-room {
    aspect-ratio: 16 / 7.2;
    margin: 10px 10px 0;
    border-radius: 18px;
  }

  .chat.is-matched .chat-status {
    margin: 8px 10px 0;
    padding: 10px 11px;
  }

  .chat.is-matched .icebreaker {
    margin: 9px 12px 0;
    padding: 9px 11px;
  }

  .chat.is-matched .messages {
    margin: 9px 10px 0;
    padding: 12px;
  }

  .chat.is-matched .empathy-tray {
    margin: 9px 10px 0;
    gap: 7px;
  }

  .chat.is-matched .composer {
    margin: 9px 10px 10px;
    padding: 9px;
  }

  .ghost {
    min-height: 40px;
    padding: 9px 13px;
    border: 1px solid var(--m-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    color: #9f3f58;
    font-size: 13px;
    font-weight: 850;
  }

  .icebreaker {
    padding: 10px 14px 0;
    color: #8a6462;
    font-size: 13px;
    line-height: 1.5;
  }

  .messages {
    min-height: 230px;
    max-height: 44svh;
    overflow-y: auto;
    padding: 12px 14px;
  }

  .message {
    width: fit-content;
    max-width: 84%;
    margin: 8px 0;
    padding: 10px 13px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    color: #443330;
    font-size: 15px;
    line-height: 1.45;
    box-shadow: 0 10px 24px rgba(83, 58, 51, 0.08);
  }

  .message:not(.system) {
    width: 100%;
    max-width: none;
    margin: 8px 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .message-avatar {
    flex-basis: 30px;
    width: 30px;
    height: 30px;
  }

  .message-avatar::before {
    top: 10px;
    left: 9px;
    width: 3px;
    height: 3px;
    box-shadow: 9px 0 rgba(93, 61, 57, 0.54);
  }

  .message-avatar::after {
    left: 11px;
    bottom: 9px;
    width: 8px;
  }

  .message-bubble {
    max-width: min(78%, 520px);
    padding: 10px 13px;
    border-radius: 16px 16px 16px 7px;
    background: rgba(255, 255, 255, 0.9);
    color: #443330;
    font-size: 15px;
    line-height: 1.45;
    box-shadow: 0 10px 24px rgba(83, 58, 51, 0.08);
  }

  .message.me {
    margin-left: auto;
    background: #fff0f3;
    color: #9f3f58;
  }

  .message.mine:not(.system) {
    margin-left: 0;
    background: transparent;
    color: inherit;
  }

  .message.mine .message-bubble {
    border-radius: 16px 16px 7px 16px;
  }

  .empathy-tray {
    padding: 0 14px 10px;
  }

  .empathy-tray button {
    min-height: 38px;
    padding: 8px 11px;
    background: rgba(255, 255, 255, 0.86);
  }

  .composer {
    display: grid;
    grid-template-columns: 42px 42px minmax(0, 1fr) 62px;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--m-line);
    background: rgba(255, 250, 247, 0.96);
  }

  .image-button,
  .composer input {
    min-height: 46px;
    border: 1px solid var(--m-line);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.92);
  }

  .image-button {
    display: grid;
    place-items: center;
    color: #9f3f58;
    font-weight: 900;
  }

  .composer input {
    width: 100%;
    padding: 0 12px;
    color: #3d2c2a;
  }

  .composer button {
    min-height: 46px;
    padding: 0 12px;
    border-radius: 15px;
    font-size: 14px;
  }

  .seo-section,
  .answer-section,
  .private-teaser {
    padding: 34px 16px;
  }

  .feature-grid,
  .answer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .feature-grid article,
  .answer-grid article,
  .private-teaser {
    border: 1px solid var(--m-line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.78);
    padding: 16px;
  }
}

@keyframes mobileLobbyWait {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(196%);
  }
}

@media (max-width: 900px) {
  body.chat-active .chat.is-matched {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100svh;
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }

  body.chat-active .chat.is-matched .matched-room,
  body.chat-active .chat.is-matched .icebreaker,
  body.chat-active .chat.is-matched .empathy-tray {
    display: none;
  }

  body.chat-active .chat.is-matched .chat-status {
    flex: 0 0 auto;
    width: calc(100vw - 20px);
    margin: 10px auto 0;
  }

  body.chat-active .chat.is-matched .messages {
    flex: 1 1 auto;
    width: calc(100vw - 20px);
    min-height: 0;
    max-height: none;
    margin: 10px auto 0;
  }

  body.chat-active .chat.is-matched .composer {
    flex: 0 0 auto;
    width: calc(100vw - 20px);
    margin: 10px auto max(10px, env(safe-area-inset-bottom));
  }
}
