:root {
  --ink: #172018;
  --panel: rgba(238, 232, 203, 0.88);
  --paper: #eee8cb;
  --accent: #b66a35;
  --road: #706b5d;
  --grass-a: #6d8060;
  --grass-b: #9a8a5a;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 10%, rgba(219, 181, 96, 0.35), transparent 28%),
    linear-gradient(135deg, #5e755b 0%, #8a8059 48%, #56685e 100%);
  color: var(--ink);
  font-family: Dotum, "돋움", "Malgun Gothic", sans-serif;
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
  outline: none;
}

.world-clock-panel {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 4;
  display: none;
  min-width: 176px;
  padding: 9px 18px 10px;
  border: 2px solid rgba(255, 216, 117, 0.34);
  border-radius: 999px;
  background: rgba(31, 19, 22, 0.82);
  box-shadow: 0 14px 38px rgba(20, 13, 18, 0.32);
  color: #ffe7a3;
  text-align: center;
  transform: translateX(-50%);
  backdrop-filter: blur(9px);
}

.world-clock-panel strong {
  font-size: 25px;
  line-height: 1;
  letter-spacing: 0.04em;
}

.world-clock-panel span {
  color: #d9c590;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.settings-toggle {
  position: fixed;
  top: 78px;
  right: 18px;
  z-index: 9;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 231, 163, 0.36);
  border-radius: 14px;
  background: rgba(23, 17, 19, 0.86);
  box-shadow: 0 12px 30px rgba(20, 13, 18, 0.26);
  color: #ffe7a3;
  font-size: 21px;
  cursor: pointer;
  backdrop-filter: blur(9px);
}

.settings-toggle:hover,
.settings-toggle[aria-expanded="true"] {
  background: rgba(55, 34, 34, 0.92);
}

.hud-panel {
  position: fixed;
  top: 132px;
  right: 18px;
  z-index: 8;
  display: grid;
  gap: 5px;
  width: 244px;
  padding: 12px 13px;
  border: 1px solid rgba(255, 231, 163, 0.28);
  border-radius: 14px;
  background: rgba(238, 232, 203, 0.9);
  box-shadow: 0 18px 50px rgba(20, 24, 18, 0.22);
  backdrop-filter: blur(10px);
  letter-spacing: -0.01em;
}

.hud-panel[hidden] {
  display: none;
}

.hud-panel strong {
  font-size: 16px;
}

.hud-panel span {
  font-size: 13px;
}

.hud-panel .hint {
  margin-top: 4px;
  color: #5f3b22;
}

.feature-audit-mini {
  display: grid;
  gap: 3px;
  margin: 4px 0;
  padding: 7px 8px;
  border: 1px solid rgba(95, 59, 34, 0.18);
  border-radius: 10px;
  background: rgba(31, 19, 22, 0.08);
}

.feature-audit-mini span {
  color: #4d3524;
  font-size: 12px;
  line-height: 1.25;
}

.ost-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}

.ost-controls button {
  padding: 7px 8px;
  border: 0;
  border-radius: 999px;
  background: rgba(31, 19, 22, 0.86);
  color: #ffe7a3;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

.ost-controls span {
  grid-column: 1 / -1;
  overflow: hidden;
  color: #5f3b22;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 4px;
}

.hud-panel a {
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff8dc;
  font-size: 13px;
  text-decoration: none;
}

.world-chat-toggle {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 7;
  min-width: 66px;
  height: 38px;
  border: 1px solid rgba(255, 231, 163, 0.28);
  border-radius: 999px;
  background: rgba(31, 19, 22, 0.86);
  box-shadow: 0 12px 30px rgba(20, 13, 18, 0.22);
  color: #ffe7a3;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}

.world-chat-toggle.active {
  background: rgba(83, 47, 31, 0.92);
}

.world-chat {
  position: fixed;
  left: 18px;
  bottom: 66px;
  z-index: 7;
  width: min(330px, calc(100vw - 36px));
  overflow: hidden;
  border: 1px solid rgba(255, 231, 163, 0.28);
  border-radius: 14px;
  background: rgba(238, 232, 203, 0.9);
  box-shadow: 0 18px 50px rgba(20, 24, 18, 0.22);
  backdrop-filter: blur(10px);
}

.world-chat.is-closed,
body.phone-focus-active .world-chat,
body.phone-stage-active .world-chat,
body.phone-focus-active .world-chat-toggle,
body.phone-stage-active .world-chat-toggle {
  display: none;
}

.world-chat-head,
.world-chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
}

.world-chat-head span {
  color: #5f3b22;
  font-size: 12px;
}

.world-chat-log {
  display: grid;
  gap: 8px;
  max-height: 144px;
  overflow: auto;
  padding: 2px 10px 10px;
  font-size: 13px;
}

.world-chat-message {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  line-height: 1.35;
}

.world-chat-name {
  max-width: 82px;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.world-chat-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.world-chat-form {
  border-top: 1px solid rgba(95, 59, 34, 0.18);
}

.world-chat-form input {
  min-width: 0;
  height: 34px;
  border: 1px solid rgba(95, 59, 34, 0.18);
  border-radius: 10px;
  padding: 0 10px;
  background: rgba(255, 248, 220, 0.66);
  outline: none;
}

.world-chat-form button {
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: rgba(31, 19, 22, 0.86);
  color: #ffe7a3;
  font-family: inherit;
  font-weight: 700;
}

@media (max-width: 640px) {
  .settings-toggle {
    top: 94px;
    right: 10px;
    width: 40px;
    height: 40px;
  }

  .world-clock-panel {
    top: 10px;
    min-width: 140px;
    padding: 7px 14px;
  }

  .world-clock-panel strong {
    font-size: 20px;
  }

  .hud-panel {
    top: 144px;
    right: 10px;
    width: min(260px, calc(100vw - 20px));
  }

  .world-chat-toggle {
    left: 10px;
    bottom: 10px;
  }

  .world-chat {
    left: 10px;
    bottom: 56px;
    width: min(310px, calc(100vw - 20px));
  }
}
