:root {
  color-scheme: dark;
  font-family: 'Leelawadee UI', Tahoma, sans-serif;
  color: #e8e9df;
  background: #091610;
  --community-gold: #dbbd80;
  --community-line: #b2c6a626;
  --community-inset: 20px;
}
* { box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body { margin: 0; background: #091610; }
button, input, textarea, select { font: inherit; }
a { color: var(--community-gold); }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; border: 1px solid #cfb67d55; background: #cbb17b; color: #10251c; border-radius: 8px; padding: 10px 16px; font-weight: 600; min-height: 44px; }
button:disabled { opacity: .5; cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #f1cf83; outline-offset: 3px; }
[hidden] { display: none !important; }
.community-shell { width: 100%; height: 100dvh; margin: 0; display: flex; flex-direction: column; min-height: 0; background: #102119; }
.community-header { flex-shrink: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 16px; min-height: 56px; padding: 5px var(--community-inset); background: #0d1c16; border-bottom: 1px solid var(--community-line); }
.community-brand { display: flex; align-items: center; gap: 10px; width: fit-content; color: #f1dfba; text-decoration: none; font: 19px Georgia, serif; letter-spacing: 3px; }
.community-brand img { width: 28px; height: 32px; object-fit: contain; }
.community-brand span { font: 9px Tahoma, sans-serif; letter-spacing: 2px; color: #9bab99; }
.community-game, .community-facebook { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 6px 12px; border: 1px solid #cfb67d55; border-radius: 8px; color: var(--community-gold); font-size: 13px; line-height: 1.5; text-decoration: none; white-space: nowrap; }
.community-game:hover, .community-facebook:hover { background: #dbbd8014; border-color: var(--community-gold); }
.community-pwa { flex-shrink: 0; max-height: 30dvh; overflow: auto; padding: 0 var(--community-inset); border-bottom: 1px solid var(--community-line); background: #0d1c16; color: #a9b69f; font-size: 12px; line-height: 1.7; }
.community-pwa summary { cursor: pointer; padding-block: 5px; min-height: 30px; }
.community-pwa button { margin: 4px 8px 4px 0; font-size: 12px; }
.community-pwa p { margin: 6px 0 12px; overflow-wrap: anywhere; }
.community-card { width: calc(100% - 32px); max-width: 460px; flex-shrink: 1; overflow: auto; margin: 32px auto; padding: 28px; background: #152a21; border: 1px solid var(--community-line); border-radius: 16px; }
.community-card h2 { font-size: 20px; font-weight: 500; margin: 0 0 12px; }
.community-card p, .community-card a { font-size: 13px; line-height: 1.7; color: #b0bda9; }
.community-card label, dialog label { display: grid; gap: 8px; margin: 18px 0; font-size: 13px; }
.community-card input, dialog textarea { width: 100%; background: #0c1d17; border: 1px solid #72856a66; color: #f2eddb; border-radius: 8px; padding: 12px; }
.community-login-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
.community-secondary { background: transparent; color: var(--community-gold); }
.community-line { background: #06c755; color: white; width: 100%; margin-top: 12px; }
.community-room { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.community-room-bar { display: flex; flex-shrink: 0; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px 12px; min-height: 54px; padding: 4px var(--community-inset); border-bottom: 1px solid var(--community-line); }
.community-room-bar h1 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0; color: #e4ddc6; font-size: 14px; font-weight: 600; line-height: 1.5; }
.community-room-bar i { width: 7px; height: 7px; flex-shrink: 0; background: #9abc84; border-radius: 50%; }
.community-room-bar h1 small { font-size: 11px; font-weight: 400; color: #9bac94; margin-left: 4px; }
.community-facebook { gap: 3px; background: #dbbd8008; font-size: 12px; }
.community-older { flex-shrink: 0; background: #182e24; color: #d1c49d; border: 0; border-bottom: 1px solid var(--community-line); border-radius: 0; font-size: 12px; padding: 8px; }
.community-messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px var(--community-inset); scrollbar-width: thin; }
.community-empty { max-width: 360px; margin: clamp(16px, 5dvh, 48px) auto 16px; padding: 12px; text-align: center; white-space: pre-line; font-size: 14px; line-height: 1.7; color: #a4b29a; }
.community-message { display: flex; gap: 10px; margin-bottom: 10px; }
.community-avatar { display: grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; color: #d9c391; background: #2d4533; border: 1px solid #a7ba9a30; font: 18px Georgia, serif; }
.community-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.community-message.own .community-avatar { background: #4a4430; }
.community-message-content { min-width: 0; flex: 1; }
.community-message-meta { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 13px; color: #dbcea8; }
.community-message-meta time { font-size: 11px; color: #85967e; }
.community-message-text { margin: 3px 0 0; line-height: 1.6; font-size: 14px; color: #e0e5d8; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
.community-message-actions { display: flex; gap: 16px; }
.community-message-actions button { border: 0; background: transparent; color: #95a88b; padding: 2px 0; font-size: 11px; min-height: 26px; font-weight: 400; }
.community-quote { margin: 4px 0; border-left: 2px solid #bba875; padding: 4px 8px; background: #ffffff05; color: #a8b79d; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.community-deleted .community-message-text { font-style: italic; color: #7e9177; }
.community-new { position: absolute; left: 50%; transform: translateX(-50%); bottom: 150px; border-radius: 24px; box-shadow: 0 3px 15px #0008; font-size: 12px; }
.community-compose { flex-shrink: 0; padding: 8px var(--community-inset) calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--community-line); background: #0d1c16; }
.community-identity { display: flex; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 12px; color: #99aa8f; }
.community-identity label { display: flex; align-items: center; gap: 8px; min-width: 0; }
.community-identity select { min-width: 100px; max-width: 190px; min-height: 32px; border: 1px solid var(--community-line); color: #e4d5ae; background: #23392b; padding: 4px 8px; border-radius: 6px; }
.community-identity > span { display: none; }
.community-compose-row { display: flex; gap: 8px; align-items: stretch; }
.community-compose textarea { flex: 1; min-width: 0; height: 48px; min-height: 48px; max-height: 100px; resize: none; border: 1px solid #7b8c6d55; background: #0b1a13; color: #edf0e6; padding: 8px 10px; border-radius: 8px; font-size: 14px; line-height: 1.5; }
.community-compose-row button { min-width: 60px; padding: 8px 12px; }
.community-compose small { display: block; color: #829379; font-size: 11px; line-height: 1.5; margin-top: 4px; }
.community-reply { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #c7bb96; font-size: 12px; margin-bottom: 10px; overflow-wrap: anywhere; }
.community-reply button { background: none; border: 0; color: #bbb; font-size: 20px; padding: 0 8px; }
.community-status { flex-shrink: 0; margin: 0; padding: 3px var(--community-inset) 5px; color: #9dac92; font-size: 11px; line-height: 1.5; background: #0d1c16; }
.community-status:empty { display: none; }
dialog { background: #152a21; border: 1px solid #a3916355; color: #e7e7da; border-radius: 16px; max-width: min(440px, 90vw); width: 100%; padding: 24px; }
dialog::backdrop { background: #000a; }
dialog h2 { font-size: 20px; }
dialog button { margin: 4px; }
dialog p { font-size: 12px; color: #d2bb84; }
/* Compact layout is shared by phones and the in-game side panel. */
@media (max-width: 600px) {
  :root { --community-inset: 12px; }
  .community-shell { border-inline: 0; }
  .community-header { min-height: 54px; gap: 8px; padding-block: 4px; }
  .community-brand { font-size: 18px; gap: 6px; letter-spacing: 2px; }
  .community-brand img { width: 26px; height: 30px; }
  .community-brand span, .community-header .language-picker span { display: none; }
  .community-game { padding: 8px 10px; font-size: 12px; }
  .community-header .language-picker select { min-height: 44px; }
  .community-room-bar { min-height: 54px; padding-block: 4px; gap: 4px 8px; }
  .community-room-bar h1 { font-size: 14px; }
  .community-room-bar h1 small { display: none; }
  .community-facebook { padding: 8px 10px; font-size: 11px; }
  .community-messages { padding-block: 12px; }
  .community-empty { padding: 8px 0; }
  .community-message { gap: 8px; margin-bottom: 10px; }
  .community-avatar { width: 30px; height: 30px; }
  .community-compose { padding-top: 8px; }
  .community-identity { margin-bottom: 6px; }
  .community-identity select { max-width: 160px; }
  .community-compose-row { gap: 8px; }
  .community-compose textarea, .community-card input { font-size: 16px; }
  .community-compose-row button { min-width: 56px; padding: 8px 10px; }
  .community-compose small { display: none; }
  .community-card { padding: 24px 20px; margin-block: 20px; }
}
@media (max-width: 359px) {
  :root { --community-inset: 12px; }
  .community-header { gap: 8px; }
  .community-brand img { display: none; }
  .community-room-bar { align-items: flex-start; }
  .community-facebook { margin-left: auto; }
}
@media (max-width: 279px) {
  .community-header { grid-template-columns: minmax(0, 1fr) auto; }
  .community-header .language-picker { grid-column: 1 / -1; justify-self: end; }
}
@media (max-height: 500px) {
  .community-header { min-height: 52px; padding-block: 4px; }
  .community-room-bar { min-height: 52px; padding-block: 4px; }
  .community-compose { padding-top: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .community-identity { margin-bottom: 6px; }
  .community-compose textarea { height: 48px; }
  .community-compose small { display: none; }
  .community-empty { margin-block: 12px; padding-block: 8px; }
}
body.community-embedded .community-header, body.community-embedded .community-pwa { display: none; }
body.community-embedded .community-shell { max-width: none; border: 0; }
body.community-embedded { --community-inset: 12px; }
body.community-embedded .community-room-bar h1 { font-size: 13px; }
body.community-embedded .community-room-bar h1 small { display: none; }
