:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #20211f;
  background: #f7f4ee;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(rgba(32, 33, 31, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32, 33, 31, 0.035) 1px, transparent 1px),
    #f7f4ee;
  background-size: 32px 32px;
}

button, input, textarea { font: inherit; }
button { color: inherit; }

.app-shell {
  width: min(1120px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr;
}

.intro {
  min-height: 112px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid #d8d3ca;
}

.brand-mark, .empty-icon {
  display: grid;
  place-items: center;
  width: 42px;
  aspect-ratio: 1;
  background: #ef5b3f;
  color: white;
  font-size: 25px;
  font-weight: 700;
}

.intro h1 { margin: 0; font-size: 25px; line-height: 1.2; letter-spacing: 0; }
.intro p { margin: 4px 0 0; color: #77766f; font-size: 13px; }

.join-view {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: clamp(48px, 10vw, 140px);
  padding: 64px 0 96px;
}

.eyebrow {
  display: block;
  margin-bottom: 14px;
  color: #368765;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.join-copy h2 {
  margin: 0;
  max-width: 640px;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(44px, 6vw, 76px);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: 0;
}

.join-copy p { max-width: 480px; margin: 28px 0 0; color: #6d6c66; font-size: 16px; line-height: 1.8; }

.join-form {
  padding: 32px;
  border: 1px solid #d3cec4;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 10px 10px 0 #dfd9ce;
}

.join-form label { display: block; margin: 0 0 8px; font-size: 13px; font-weight: 700; }
.join-form > input, .room-input-wrap { margin-bottom: 22px; }

input, textarea {
  width: 100%;
  border: 1px solid #c8c3b9;
  border-radius: 0;
  outline: none;
  background: #fffdf8;
  transition: border-color 150ms, box-shadow 150ms;
}

input { height: 50px; padding: 0 14px; }
input:focus, textarea:focus { border-color: #368765; box-shadow: 0 0 0 3px rgba(54, 135, 101, 0.13); }

.room-input-wrap { display: grid; grid-template-columns: 1fr 50px; }
.room-input-wrap input { border-right: 0; text-transform: uppercase; font-weight: 700; letter-spacing: 0; }

.icon-button {
  width: 50px;
  height: 50px;
  border: 1px solid #c8c3b9;
  background: #fffdf8;
  cursor: pointer;
  font-size: 24px;
}
.icon-button:hover { background: #f0ece4; }

.primary-button {
  width: 100%;
  height: 52px;
  border: 0;
  background: #20211f;
  color: white;
  cursor: pointer;
  font-weight: 700;
}
.primary-button span { margin-left: 8px; font-size: 18px; }
.primary-button:hover { background: #368765; }

.room-view { min-height: 0; padding: 32px 0 28px; grid-template-rows: auto 1fr auto; }
.room-view:not([hidden]) { display: grid; }

.room-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 22px; border-bottom: 1px solid #d8d3ca; }
.room-header .eyebrow { margin-bottom: 5px; }
.room-code { display: flex; align-items: center; gap: 9px; padding: 0; border: 0; background: none; cursor: pointer; font-size: 27px; font-weight: 800; }
.room-code span:last-child { color: #8a8880; font-size: 17px; }
.room-actions { display: flex; align-items: center; gap: 16px; }
.status { color: #77766f; font-size: 13px; }
.status i { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #d99b45; }
.status.online i { background: #368765; }
.status.offline i { background: #bc4738; }

.message-list { min-height: 300px; overflow-y: auto; padding: 28px 2px; }
.empty-state { height: 100%; min-height: 300px; display: grid; place-content: center; justify-items: center; color: #77766f; text-align: center; }
.empty-state .empty-icon { width: 54px; margin-bottom: 15px; background: #e5dfd5; color: #77766f; }
.empty-state h2 { margin: 0; color: #3e3f3b; font-size: 20px; }
.empty-state p { margin: 8px 0 0; font-size: 14px; }

.message { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: start; max-width: 760px; margin: 0 0 22px; }
.message-avatar { display: grid; place-items: center; width: 42px; aspect-ratio: 1; background: #368765; color: white; font-weight: 800; }
.message-meta { margin-bottom: 6px; color: #77766f; font-size: 12px; }
.message-meta strong { color: #30312e; margin-right: 8px; }
.message-text { margin: 0; padding: 13px 15px; background: #fffdf8; border: 1px solid #d8d3ca; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-time { padding-top: 2px; color: #99978f; font-size: 11px; }
.file-card { display: flex; align-items: center; gap: 12px; width: min(430px, 100%); padding: 12px 14px; border: 1px solid #d8d3ca; background: #fffdf8; color: inherit; text-decoration: none; }
.file-card:hover { border-color: #368765; }
.file-symbol { display: grid; place-items: center; width: 38px; aspect-ratio: 1; background: #e8ede7; color: #368765; font-size: 20px; }
.file-info { min-width: 0; }
.file-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.file-info small { color: #77766f; }

.composer { display: grid; grid-template-columns: 50px 1fr 50px; align-items: end; border: 1px solid #c8c3b9; background: #fffdf8; }
.composer:focus-within { border-color: #368765; box-shadow: 0 0 0 3px rgba(54, 135, 101, 0.13); }
.file-button, .send-button { display: grid; place-items: center; width: 50px; height: 50px; border: 0; background: transparent; cursor: pointer; font-size: 24px; }
.file-button:hover { background: #f0ece4; }
.composer textarea { min-height: 50px; max-height: 150px; padding: 14px 4px; resize: none; border: 0; box-shadow: none; line-height: 1.5; }
.send-button { margin: 5px; width: 40px; height: 40px; background: #ef5b3f; color: white; font-weight: 800; }
.send-button:hover { background: #d9472d; }
.send-button:disabled { opacity: 0.45; cursor: wait; }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 10; transform: translate(-50%, 20px); padding: 10px 16px; background: #20211f; color: white; opacity: 0; pointer-events: none; transition: 180ms; font-size: 13px; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .app-shell { width: min(100% - 28px, 620px); }
  .intro { min-height: 88px; }
  .intro p { display: none; }
  .join-view { grid-template-columns: 1fr; align-content: center; gap: 40px; padding: 42px 0 72px; }
  .join-copy h2 { font-size: 43px; }
  .join-copy p { margin-top: 18px; font-size: 14px; }
  .join-form { padding: 24px; box-shadow: 7px 7px 0 #dfd9ce; }
  .room-view { padding-top: 20px; }
  .status { font-size: 0; }
  .status i { margin-right: 0; }
  .message { grid-template-columns: 36px 1fr; gap: 10px; }
  .message-avatar { width: 36px; }
  .message-time { display: none; }
}
