:root {
  color-scheme: light;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: #f7f7f2;
  color: #202525;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-height: 100vh; min-height: 100dvh; margin: 0; overflow-x: hidden; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible, input:focus-visible { outline: 3px solid #67c0ab; outline-offset: 3px; }
.ambient { position: fixed; pointer-events: none; z-index: -1; border-radius: 50%; filter: blur(16px); }
.ambient-one { width: 380px; height: 380px; top: -190px; right: -130px; background: rgba(179, 228, 215, .36); }
.ambient-two { width: 330px; height: 330px; bottom: -220px; left: -165px; background: rgba(243, 202, 166, .3); }
.shell { width: min(100% - 36px, 660px); margin: 0 auto; padding: 48px 0 38px; }
.hero { text-align: center; padding: 12px 0 34px; }
.hero-symbol { position: relative; width: 114px; height: 94px; margin: 0 auto 6px; }
.bubble { position: absolute; top: 24px; width: 68px; height: 59px; border-radius: 31px 31px 23px 29px; transform: rotate(-18deg); }
.bubble-a { left: 11px; background: #a9dcd1; }
.bubble-b { right: 9px; background: #f0bfa6; opacity: .86; transform: rotate(18deg); mix-blend-mode: multiply; }
.hero-star { position: absolute; z-index: 1; top: 17px; left: 43px; font-size: 37px; color: #27574f; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(52px, 11vw, 76px); letter-spacing: -.065em; font-weight: 850; line-height: 1.06; margin-bottom: 18px; }
.accent { color: #357a6f; }
.title-period { color: #efb18d; }
.entry-card, .how-card, .game-card, .timeline-card, .room-link-card { background: rgba(255, 255, 255, .9); border: 1px solid rgba(41, 68, 61, .075); box-shadow: 0 14px 35px rgba(28, 55, 48, .055); border-radius: 24px; }
.entry-card { padding: 30px; }
.field-label { display: block; font-size: 14px; font-weight: 730; margin-bottom: 11px; }
.muted { font-size: 12px; color: #a1aaa6; font-weight: 500; }
.text-input { width: 100%; height: 53px; border: 1.5px solid #e0e9e4; background: #fafcf9; border-radius: 13px; padding: 0 16px; outline: none; color: #243b34; min-width: 0; transition: border .2s, background .2s; }
.text-input:focus { border-color: #4d9a88; background: white; }
.text-input::placeholder { color: #acb6ae; }
.btn { border: 0; min-height: 48px; border-radius: 13px; padding: 12px 19px; font-size: 14px; font-weight: 750; display: inline-flex; justify-content: center; align-items: center; gap: 9px; white-space: nowrap; transition: transform .16s, background .16s; }
.btn:not(:disabled):active { transform: translateY(1px); }
.btn-primary { color: white; background: #2d6f62; }
.btn-primary:hover:not(:disabled) { background: #205d52; }
.btn-wide { width: 100%; margin-top: 14px; justify-content: space-between; padding: 0 21px; height: 54px; }
.btn-wide span:last-child { font-size: 24px; font-weight: 500; line-height: 1; }
.btn-secondary { background: #e4f0e9; color: #286a5a; }
.btn-secondary:hover { background: #d4e8de; }
.btn-quiet { background: #eef4ef; color: #386f60; min-height: 42px; }
.btn-quiet:hover { background: #e1eee5; }
.divider-text { display: flex; align-items: center; gap: 14px; font-size: 12px; color: #9baaa1; margin: 26px 0 17px; }
.divider-text:before, .divider-text:after { content: ''; height: 1px; background: #ebefeb; flex: 1; }
.join-row { display: flex; gap: 10px; }
.join-row .btn { padding: 0 27px; }
.how-card { margin-top: 20px; padding: 24px 27px 22px; background: rgba(253, 254, 252, .65); box-shadow: none; }
.how-heading { display: flex; align-items: center; gap: 10px; color: #52877c; white-space: nowrap; }
.how-steps { display: grid; gap: 17px; margin: 23px 0 20px; }
.how-steps>div { display: flex; align-items: baseline; gap: 15px; font-size: 14px; color: #4c5e57; }
.step-index { color: #80a9a0; font-weight: 800; font-size: 12px; letter-spacing: .04em; }
.how-note { border-top: 1px dashed #e1e8e2; padding-top: 16px; color: #99a49e; font-size: 12px; line-height: 1.7; margin: 0; }

/* Playing room */
.shell-game { width: min(100% - 36px, 760px); padding-top: 30px; }
.room-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.brand-small { font-size: 20px; font-weight: 850; letter-spacing: -.045em; }
.brand-mark { color: #4b9b85; font-size: 27px; vertical-align: -2px; }
.text-button { background: transparent; border: 0; color: #82908a; font-size: 13px; padding: 10px 0 10px 10px; }
.text-button:hover { color: #285d51; }
.room-link-card { border-radius: 19px; padding: 17px 23px; display: flex; gap: 12px; justify-content: space-between; align-items: center; box-shadow: none; }
.mini-label { color: #98aba2; font-size: 10px; }
.room-id { font-size: 21px; font-weight: 850; letter-spacing: .125em; margin-top: 5px; color: #47796b; }
.copy-icon { font-size: 21px; line-height: .7; font-weight: 500; }
.network-line { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 14px 8px; color: #8a9891; font-size: 12px; min-height: 43px; }
.presence-dot { width: 7px; height: 7px; border-radius: 50%; background: #dfae7b; }
.presence-dot.connected { background: #63ab88; }
.presence-dot.disconnected { background: #e08a80; }
.game-card { border-radius: 27px; padding: 32px 35px 34px; }
.round-top { display: flex; align-items: center; justify-content: space-between; color: #8ba99a; }
.round-number { font-size: 12px; font-weight: 850; letter-spacing: .09em; color: #337b67; }
.game-title-row { display: flex; align-items: center; gap: 14px; justify-content: space-between; margin-top: 14px; }
.game-title-row h2 { font-size: 29px; letter-spacing: -.045em; line-height: 1.28; margin-bottom: 0; }
.seat-chip { background: #e8f5ec; color: #447c68; padding: 8px 12px; border-radius: 30px; font-size: 12px; font-weight: 750; }
.people { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.person { border: 1px solid #ecf0ec; border-radius: 16px; display: flex; align-items: center; padding: 13px; gap: 11px; min-width: 0; background: #fbfcfa; }
.avatar { width: 39px; height: 39px; flex: 0 0 39px; border-radius: 12px; display: grid; place-items: center; color: #4c7e72; font-weight: 850; }
.avatar-a { background: #d9f1e7; }
.avatar-b { background: #fae6d7; color: #bb8a69; }
.person-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.person-text strong { font-size: 13px; font-weight: 750; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.person-text small { font-size: 11px; color: #a3afa7; white-space: nowrap; }
.online-indicator { background: #cdd7ce; height: 7px; width: 7px; border-radius: 100%; margin-left: auto; flex-shrink: 0; }
.online-indicator.on { background: #69bc8e; }
.section-divider { display: flex; align-items: center; gap: 16px; margin: 28px 0 18px; font-size: 12px; color: #95a69b; }
.section-divider:after { content: ''; height: 1px; background: #edf0ed; flex: 1; }
.answer-pair { display: grid; grid-template-columns: minmax(0,1fr) 30px minmax(0,1fr); gap: 9px; align-items: center; }
.answer { border-radius: 17px; padding: 20px 12px; min-height: 115px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; text-align: center; }
.answer-a { background: #eaf6f1; }
.answer-b { background: #fdf0e5; }
.answer-label { font-size: 12px; color: #86a99c; margin-bottom: 8px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.answer-b .answer-label { color: #bb9c88; }
.answer-word { font-size: clamp(19px, 5vw, 29px); font-weight: 850; color: #326b5a; overflow-wrap: anywhere; letter-spacing: -.045em; }
.answer-b .answer-word { color: #ad6e52; }
.answer-middle { color: #93a39b; text-align: center; font-size: 21px; font-weight: 750; }
.word-entry { display: flex; gap: 10px; }
.word-input { height: 58px; font-size: 17px; font-weight: 700; }
.submit-btn { min-height: 58px; padding: 0 22px; }
.locked-box { margin-top: 25px; border-radius: 17px; padding: 22px; background: #ecf7f1; display: flex; gap: 15px; align-items: start; }
.lock-symbol { flex: 0 0 39px; height: 39px; background: #4a967c; color: white; border-radius: 100%; display: grid; place-items: center; font-size: 20px; }
.victory-box { padding: 37px 10px 6px; text-align: center; }
.victory-symbol { font-size: 63px; line-height: 1; color: #3a9a7a; animation: spin-pop .6s ease-out both; }
.victory-box h3 { font-size: 32px; letter-spacing: -.05em; margin-bottom: 10px; }
.timeline-card { padding: 25px 28px 20px; margin-top: 18px; box-shadow: none; background: rgba(255,255,255,.72); }
.timeline-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 17px; }
.timeline-header h3 { font-size: 16px; margin: 0; }
.timeline-header span { color: #9ab0a5; font-size: 11px; letter-spacing: .1em; font-weight: 750; }
.history-list { margin: 0; padding: 0; list-style: none; }
.history-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid #eef1ec; font-size: 13px; }
.history-index { font-size: 11px; color: #a8b6aa; min-width: 35px; font-weight: 750; }
.history-words { flex: 1; overflow-wrap: anywhere; min-width: 0; color: #60746a; }
.history-words strong { color: #355b4c; font-weight: 700; }
.history-sep { padding: 0 8px; color: #b2c1b6; }
.history-match { font-size: 11px; color: #328867; font-weight: 750; white-space: nowrap; }
.toast { position: fixed; left: 50%; bottom: max(25px, env(safe-area-inset-bottom)); transform: translate(-50%, 12px); background: #2a463d; color: white; box-shadow: 0 14px 35px #16382c33; border-radius: 12px; padding: 13px 18px; font-size: 13px; opacity: 0; visibility: hidden; z-index: 20; transition: opacity .2s, transform .2s, visibility .2s; text-align: center; width: max-content; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); visibility: visible; }
@keyframes spin-pop { 0% { transform: scale(.5) rotate(-50deg); opacity: 0; } 70% { transform: scale(1.16) rotate(7deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
@media (max-width: 560px) {
  .shell { width: min(100% - 32px, 660px); padding-top: 28px; }
  .hero { padding-bottom: 27px; }
  .hero-symbol { transform: scale(.86); margin-top: -9px; margin-bottom: -4px; }
  h1 { margin-bottom: 16px; }
  .entry-card { padding: 22px; }
  .how-card { padding: 22px; }
  .join-row .btn { padding: 0 16px; }
  .shell-game { padding-top: 20px; }
  .room-header { margin-bottom: 17px; }
  .brand-small { font-size: 18px; }
  .room-link-card { padding: 15px; gap: 6px; }
  .room-id { font-size: 17px; letter-spacing: .075em; }
  .btn-quiet { font-size: 12px; padding: 11px 10px; }
  .game-card { padding: 25px 19px 26px; border-radius: 23px; }
  .game-title-row h2 { font-size: 25px; }
  .people { gap: 8px; }
  .person { padding: 10px; gap: 7px; }
  .avatar { width: 30px; height: 30px; flex-basis: 30px; border-radius: 9px; }
  .person-text strong { font-size: 12px; }
  .person-text small { font-size: 10px; }
  .online-indicator { width: 6px; height: 6px; }
  .word-entry { display: flex; flex-direction: column; }
  .submit-btn { width: 100%; }
  .timeline-card { padding: 22px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

.random-button { margin-top: .65rem; }
.history-timing { color: #64675e; white-space: nowrap; }
#recentRooms { display: flex; flex-wrap: wrap; gap: .65rem 1rem; }
#recentRooms a { color: inherit; font-size: .88rem; }
.archive-list details { margin-top: .8rem; }
.archive-list summary { cursor: pointer; font-weight: 600; }
.archive-list .history-list { margin-top: .5rem; }
@media (max-width: 480px) {
  .history-timing { font-size: .67rem; }
  .history-item { flex-wrap: wrap; }
}
@media (max-width: 360px) {
  .person-text small { white-space: normal; }
}

.game-layout > *, .game-layout .answer { min-width: 0; }
.opening-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.opening-pair .answer { min-height: 86px; }
.history-opening { display: grid; gap: 7px; color: #487767; }
.history-opening-words { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.history-opening-words > span { display: grid; gap: 4px; overflow-wrap: anywhere; border-radius: 10px; padding: 8px 11px; background: #eaf6f1; }
.history-opening-words > span:nth-child(2) { background: #fdf0e5; color: #94634a; }
.finish-box { margin-top: 16px; }
.finish-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.finish-actions .btn { padding-inline: 12px; }
.finish-actions [aria-pressed="true"] { opacity: 1; background: #d6ece0; }
#finishStatus, #personalStatus { margin: 10px 0 0; color: #546f63; font-size: 13px; }
#finishStatus:empty, #personalStatus:empty { display: none; }
.chat-card summary, .personal-history > summary, .personal-room > details > summary { cursor: pointer; font-weight: 750; }
.chat-messages { display: flex; flex-direction: column; gap: 10px; min-height: 86px; max-height: 230px; overflow-y: auto; margin: 12px 0; padding: 0 6px 0 0; list-style: none; }
.chat-messages li { display: grid; gap: 3px; padding: 7px 10px; border-radius: 10px; background: #eef4ef; font-size: 13px; overflow-wrap: anywhere; }
.chat-messages strong { color: #386f60; font-size: 12px; }
.chat-form { display: flex; gap: 6px; }
.chat-form .btn { padding-inline: 11px; }
.chat-form input { height: 48px; padding-inline: 10px; }
.personal-room { padding: 11px 0; border-bottom: 1px solid #edf0ed; }
.personal-room:first-child { margin-top: 8px; }
.personal-room .archive-list { padding-inline: 12px; }
.personal-room .archive-list p { margin: 10px 0 0; }
.personal-room a { display: inline-block; padding: 10px 12px 0; color: #286a5a; font-size: 13px; }

@media (min-width: 960px) {
  .shell-game { width: min(100% - 48px, 1040px); }
  .game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 262px; gap: 18px; align-items: start; }
  .chat-card { margin: 0; padding: 20px 16px; }
  .chat-messages { min-height: 150px; max-height: 300px; }
}
.mini-label, .how-heading { font-size: 12px; letter-spacing: .09em; font-weight: 800; }
.network-line { padding-block: 6px; }
#reconnectBtn { color: #286a5a; text-decoration: underline; }
.people { margin-top: 20px; }
.turn-box { margin-top: 24px; }
.locked-box { align-items: center; overflow-wrap: anywhere; }
.locked-box > div:last-child { min-width: 0; }
.victory-box h3 { margin-top: 12px; margin-bottom: 18px; }
.account-card summary { cursor: pointer; font-weight: 750; }
.account-card fieldset { margin: 14px 0 0; border: 0; padding: 0; min-width: 0; }
.account-card .field-label { margin: 9px 0; }
.account-actions, .account-session { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
#accountName { overflow-wrap: anywhere; }
#accountStatus { margin: 12px 0 0; color: #805144; font-size: 13px; }
#accountStatus:empty { display: none; }
