@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700;800&family=Marcellus&display=swap");
@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css");

:root {
  --bg: #1f1712;
  --panel: rgba(31, 22, 16, 0.9);
  --panel-2: rgba(23, 17, 13, 0.95);
  --frame: #7a5a3a;
  --frame-2: #b58b58;
  --text: #f3e3c8;
  --muted: #d4bf9e;
  --blue: #1f3a6f;
  --red: #8f1d20;
  --gold: #e6bf7f;
  --ok: #5fd474;
  --off: #ff665a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  color: var(--text);
  font-family: "Marcellus", "Trebuchet MS", serif;
  background: linear-gradient(180deg, #cfb690 0%, #b99a72 55%, #9f815d 100%);
  background: url(bg_hd.png) no-repeat center center fixed !important;
  background-size: cover !important;
}

a { color: inherit; text-decoration: none; }

.site-wrap {
  width: min(1240px, calc(100% - 16px));
  margin: 8px auto 16px;
}

.hud {
  width: min(520px, 100%);
  margin: 0 auto 6px;
  height: 30px;
  border: 2px solid #35271c;
  background: linear-gradient(#2a2017, #14100d);
  display: grid;
  grid-template-columns: 1fr 1fr 80px 1fr;
  align-items: center;
  font-size: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,.35);
}

.hud div { text-align: center; }
.hud .gold { color: #ffdc94; }
.hud .food { color: #ffc88e; }
.hud-city {
  width: min(520px, 100%);
  margin: 0 auto 8px;
  border: 2px solid #35271c;
  background: linear-gradient(#1e1711, #120d0a);
  text-align: center;
  font-size: 13px;
  padding: 4px 8px;
  color: #f0d29f;
}

.city-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.top-links {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 0 0 8px;
  flex-wrap: wrap;
}

.top-links a {
  border: 1px solid #6f5438;
  background: linear-gradient(#223f74, #13284f);
  padding: 4px 8px;
  font-size: 20px;
}

.top-links a.active {
  background: linear-gradient(#9a2327, #6f171a);
}

.city {
  width: 74px;
  border: 2px solid #2d231a;
  background: linear-gradient(#45090c, #0c0b12);
  padding: 4px 4px 3px;
  text-align: center;
  font-size: 11px;
}

.city img {
  width: 100%;
  height: 42px;
  object-fit: cover;
  border: 1px solid #5b4b39;
  margin-bottom: 2px;
}

.layout {
  display: grid;
  grid-template-columns: 190px 1fr 190px;
  gap: 10px;
}

.logo {
  font-family: "Cinzel", "Georgia", serif;
  color: #b3161b;
  font-size: 49px;
  line-height: 1;
  margin: 4px 0 8px 10px;
  text-shadow: 1px 1px 0 #f3d6a1;
}

.panel {
  border: 2px solid var(--frame);
  box-shadow: inset 0 0 0 1px #ceb086;
  background: var(--panel);
}

.panel-title {
  font-family: "Cinzel", serif;
  background: linear-gradient(#d29a63, #b97f4a);
  color: #130f0b;
  padding: 7px 8px;
  font-size: 20px;
  text-align: center;
  border-bottom: 1px solid #5f452d;
}

.left-menu a {
  display: block;
  padding: 6px 10px;
  font-size: 17px;
  border-bottom: 1px solid rgba(204, 161, 105, .22);
  background: linear-gradient(90deg, rgba(28,58,111,.45), rgba(28,58,111,0));
}

.left-menu a.active,
.left-menu a:hover {
  background: linear-gradient(90deg, rgba(143,29,32,.58), rgba(143,29,32,.08));
}

.left-menu i,
.top-links i { margin-right: 6px; font-size: 13px; }

.center-title {
  text-align: center;
  margin-bottom: 6px;
  color: #f3dcb2;
  font-size: 24px;
}

.content-panel {
  border: 2px solid var(--frame);
  box-shadow: inset 0 0 0 1px #c8a176;
  background: var(--panel-2);
  margin-bottom: 8px;
}

.content-head {
  font-family: "Cinzel", serif;
  background: linear-gradient(#d29a63, #b97f4a);
  color: #150f0a;
  padding: 7px 8px;
  font-size: 22px;
  text-align: center;
  border-bottom: 1px solid #61462f;
}

.content-body { padding: 8px; }

.unit-list { display: grid; gap: 6px; }

.unit {
  border: 1px solid #795638;
  background: rgba(40, 28, 19, .9);
  display: grid;
  grid-template-columns: 64px 1fr 90px;
  gap: 8px;
  align-items: center;
  padding: 6px;
}

.unit img { width: 64px; height: 64px; object-fit: cover; border: 1px solid #5b4633; }
.unit h4 { margin: 0 0 2px; font-size: 20px; color: var(--gold); }
.unit p { margin: 0; font-size: 15px; color: var(--muted); }

.btn-mini {
  border: 1px solid #705034;
  background: linear-gradient(#cb925c, #a16735);
  color: #120d09;
  font-size: 16px;
  padding: 5px 4px;
  text-align: center;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th, td {
  border: 1px solid #6e5034;
  padding: 4px 6px;
}

th { color: #f0cf97; background: rgba(90, 60, 35, .45); }

.msg {
  border: 1px solid #775236;
  margin-bottom: 6px;
  padding: 8px;
  background: rgba(38, 27, 20, .9);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.msg strong { font-size: 18px; display: block; margin-bottom: 2px; }
.msg small { color: var(--muted); font-size: 14px; }
.del { color: #ff534b; font-size: 14px; }

.status-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(204,161,105,.24);
  font-size: 16px;
}

.status-row:last-child { border-bottom: 0; }
.online { color: var(--ok); }
.offline { color: var(--off); }

.forum-item {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(204,161,105,.22);
  font-size: 15px;
}

.forum-item:last-child { border-bottom: 0; }

.footer-note {
  text-align: center;
  color: #f0dab9;
  font-size: 14px;
  margin-top: 6px;
}

.land-wrap {
  width: min(1280px, calc(100% - 20px));
  margin: 14px auto;
}

.land-hero {
  border: 2px solid #61462f;
  background: linear-gradient(110deg, rgba(24,17,13,.92) 0 62%, rgba(24,17,13,.58) 100%);
  padding: 28px;
  box-shadow: 0 8px 18px rgba(0,0,0,.4);
}

.land-hero h1 { margin: 0 0 10px; font-family: "Cinzel", serif; font-size: 52px; color: var(--gold); }
.land-hero p { margin: 0 0 12px; font-size: 24px; color: var(--muted); max-width: 36ch; }
.land-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.big-btn {
  border: 1px solid #6d4e31;
  padding: 10px 16px;
  font-family: "Cinzel", serif;
  font-size: 16px;
  background: linear-gradient(#b42a2f, #7a171a);
}
.big-btn.alt { background: linear-gradient(#2b4f94, #1c3566); }

.land-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 8px;
}

.land-card {
  border: 1px solid #745334;
  background: rgba(30,22,16,.85);
  padding: 10px;
}

.land-card h3 { margin: 0 0 6px; font-family: "Cinzel", serif; color: var(--gold); font-size: 24px; }
.land-card p { margin: 0; color: var(--muted); font-size: 17px; }

.auth-wrap {
  width: min(1180px, calc(100% - 16px));
  margin: 14px auto;
  border: 2px solid #62472f;
  background: rgba(20,14,11,.9);
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-side {
  padding: 18px;
  background: linear-gradient(135deg, rgba(36,26,20,.95), rgba(24,17,13,.7));
  border-right: 1px solid #684a31;
}

.auth-side h1 { margin: 0 0 8px; font-family: "Cinzel", serif; color: var(--gold); font-size: 44px; }
.auth-side p { margin: 0; font-size: 24px; color: var(--muted); }

.auth-form { padding: 18px; }
.auth-form h2 { margin: 0 0 10px; font-family: "Cinzel", serif; color: var(--gold); font-size: 34px; }
.auth-form label { display: block; margin: 7px 0 4px; font-size: 17px; }
.auth-form input, .auth-form select {
  width: 100%;
  border: 1px solid #7a5a3a;
  background: #1a1310;
  color: var(--text);
  padding: 10px;
  font-size: 16px;
}
.auth-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.menu-toggle {
  display: none;
  width: 100%;
  border: 1px solid #6f5034;
  background: linear-gradient(#223f74, #162b54);
  color: #f4e7d0;
  font-family: "Cinzel", serif;
  font-size: 16px;
  padding: 8px 10px;
  margin: 0 0 6px;
  text-align: left;
}
.menu-toggle i { margin-right: 6px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .logo { margin-left: 0; text-align: center; }
  .land-grid { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .menu-toggle { display: block; }
  .left-menu { display: none; }
  .left-menu.open { display: block; }
}

.map-shell {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 10px;
}

.map-controls {
  border: 1px solid #745336;
  background: rgba(27, 20, 15, 0.92);
  padding: 10px;
}

.map-controls h3 {
  margin: 0 0 8px;
  font-family: "Cinzel", serif;
  font-size: 18px;
  color: var(--gold);
}

.map-controls label {
  display: block;
  margin: 8px 0 4px;
  font-size: 14px;
  color: #dec9a9;
}

.map-controls input,
.map-controls select,
.map-controls button {
  width: 100%;
  border: 1px solid #755337;
  background: #1a1310;
  color: var(--text);
  padding: 8px;
  font-family: "Marcellus", serif;
  font-size: 14px;
}

.map-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

.coord-row {
  display: grid;
  grid-template-columns: 1fr 1fr 44px;
  gap: 6px;
}

.wide-btn {
  margin-top: 8px;
  background: linear-gradient(#aa2b2f, #71171a) !important;
}

.map-info {
  margin-top: 9px;
  border: 1px solid rgba(204, 159, 104, 0.35);
  background: rgba(14, 10, 8, 0.75);
  padding: 8px;
  font-size: 13px;
  line-height: 1.3;
  color: #d9c5a5;
  min-height: 90px;
}

.mini-map-box {
  margin-top: 9px;
  border: 1px solid rgba(204, 159, 104, 0.35);
  background: rgba(14, 10, 8, 0.75);
  padding: 8px;
}

.mini-map-box h3 {
  margin: 0 0 6px;
  font-family: "Cinzel", serif;
  font-size: 16px;
  color: var(--gold);
}

.mini-map-box canvas {
  width: 100%;
  height: auto;
  border: 1px solid #866243;
  background: #15100d;
  display: block;
}

.mini-map-box small {
  display: block;
  margin-top: 5px;
  color: #ceb897;
  font-size: 12px;
  line-height: 1.25;
}

.map-stage-wrap {
  border: 1px solid #78573a;
  background: rgba(14, 11, 9, 0.9);
  padding: 8px;
}

.map-stage {
  position: relative;
  height: 640px;
  overflow: hidden;
  border: 1px solid rgba(198, 160, 105, 0.35);
  background: #14100c;
}

.map-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.hover-tip {
  display: none;
  position: absolute;
  z-index: 20;
  padding: 4px 6px;
  font-size: 12px;
  color: #f4e6cf;
  background: rgba(16, 12, 9, 0.92);
  border: 1px solid #876241;
  pointer-events: none;
  white-space: nowrap;
}

.village-menu {
  display: none;
  position: absolute;
  z-index: 30;
  min-width: 190px;
  border: 1px solid #8b6743;
  background: rgba(18, 13, 10, 0.97);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
}

.village-menu button {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(173, 132, 84, 0.3);
  padding: 8px 10px;
  background: transparent;
  color: #f0dfc2;
  text-align: left;
  font-family: "Marcellus", serif;
  font-size: 14px;
  cursor: pointer;
}

.village-menu button:last-child {
  border-bottom: 0;
}

.village-menu button:hover {
  background: rgba(143, 29, 32, 0.4);
}

.village-menu button i {
  margin-right: 6px;
}

@media (max-width: 1000px) {
  .map-shell { grid-template-columns: 1fr; }
  .map-stage { height: 500px; }
}

.yapi-link {
  background: transparent;
  border: 0;
  color: #f0cf97;
  text-decoration: underline;
  font-family: "Marcellus", serif;
  font-size: 15px;
  cursor: pointer;
  padding: 0;
}

.mw-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 10px;
}

.mw-modal.open {
  display: flex;
}

.mw-modal-box {
  width: min(620px, 100%);
  border: 2px solid #7a5a3a;
  box-shadow: inset 0 0 0 1px #ceb086;
  background: rgba(23, 17, 13, 0.97);
  color: var(--text);
  padding: 14px;
}

.mw-modal-box h3 {
  margin: 0 0 8px;
  font-family: "Cinzel", serif;
  color: var(--gold);
  font-size: 26px;
}

.mw-modal-box p {
  margin: 8px 0;
  font-size: 16px;
  color: var(--muted);
}

.mw-modal-close {
  float: right;
  border: 1px solid #6d4e31;
  padding: 6px 10px;
  font-family: "Cinzel", serif;
  font-size: 14px;
  background: linear-gradient(#b42a2f, #7a171a);
  color: #f3e3c8;
  cursor: pointer;
}