:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #1f2937;
  --muted: #667085;
  --line: #d9e0ea;
  --primary: #176b87;
  --primary-dark: #0f5369;
  --accent: #f2b84b;
  --danger: #b42318;
  --bubble: #eef5f7;
  --mine: #dff3ea;
  --shadow: 0 18px 60px rgba(31, 41, 55, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(23, 107, 135, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(242, 184, 75, 0.18), transparent 30%),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(1120px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px;
  display: grid;
  place-items: center;
}

.entry-panel,
.chat-panel {
  width: min(100%, 460px);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(217, 224, 234, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.entry-panel {
  padding: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  font-weight: 800;
  font-size: 22px;
}

h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
  padding: 4px;
  background: #eef2f6;
  border-radius: 8px;
}

.tab {
  border: 0;
  min-height: 40px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.tab.is-active {
  color: var(--ink);
  background: white;
  box-shadow: 0 1px 6px rgba(31, 41, 55, 0.08);
}

.entry-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: white;
  outline: none;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 107, 135, 0.14);
}

.primary-button,
.send-button,
.icon-button,
.file-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
}

.primary-button,
.send-button {
  color: white;
  background: var(--primary);
}

.primary-button:hover,
.send-button:hover {
  background: var(--primary-dark);
}

.chat-panel {
  width: min(100%, 920px);
  height: min(760px, calc(100vh - 64px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.chat-header {
  min-height: 72px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.caption {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

#roomNumber {
  font-size: 24px;
  letter-spacing: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.online {
  color: var(--muted);
  font-size: 14px;
}

.icon-button,
.file-button {
  display: inline-grid;
  place-items: center;
  color: var(--primary);
  background: #e8f2f5;
  white-space: nowrap;
}

.icon-button.danger {
  color: var(--danger);
  background: #fff0ee;
}

.messages {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message {
  width: min(78%, 560px);
  display: grid;
  gap: 5px;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.message.mine {
  align-self: flex-end;
}

.message.burning {
  opacity: 0;
  transform: translateY(-4px);
}

.meta {
  color: var(--muted);
  font-size: 12px;
}

.message.mine .meta {
  text-align: right;
}

.bubble {
  position: relative;
  width: fit-content;
  max-width: 100%;
  padding: 11px 13px;
  border-radius: 8px;
  background: var(--bubble);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.message.mine .bubble {
  margin-left: auto;
  background: var(--mine);
}

.bubble img {
  display: block;
  max-width: min(100%, 360px);
  max-height: 320px;
  border-radius: 6px;
  object-fit: contain;
}

.burn-badge {
  display: inline-block;
  margin-left: 8px;
  color: var(--danger);
  font-size: 12px;
  white-space: nowrap;
}

.composer {
  padding: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 10px;
  align-items: center;
  background: rgba(255, 255, 255, 0.86);
}

.file-button input {
  display: none;
}

.burn-toggle {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
  white-space: nowrap;
}

.burn-toggle input {
  width: 16px;
  min-height: 16px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  background: #1f2937;
  color: white;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(31, 41, 55, 0.24);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 700px) {
  .app-shell {
    padding: 0;
  }

  .entry-panel {
    width: calc(100% - 28px);
    padding: 22px;
  }

  .chat-panel {
    width: 100%;
    height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .chat-header {
    align-items: flex-start;
  }

  .messages {
    padding: 14px;
  }

  .message {
    width: 88%;
  }

  .composer {
    grid-template-columns: auto 1fr auto;
  }

  .burn-toggle {
    grid-column: 1 / -1;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .chat-header {
    display: grid;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .composer {
    grid-template-columns: 1fr auto;
  }

  .file-button,
  .burn-toggle {
    grid-column: auto;
  }

  #messageInput {
    grid-column: 1 / -1;
  }
}
