:root {
  --bg: #0b1020;
  --bg2: #121b32;
  --card: #0f1a31;
  --text: #e8edf7;
  --muted: #9eb0d2;
  --accent: #3ad5bf;
  --border: #293a62;
  --danger: #ff6d6d;
  --ok: #43d688;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 700px at 80% -10%, #193665 0%, #0b1020 45%, #080c18 100%);
  overscroll-behavior: none;
  overflow-x: hidden;
}

a { color: #7edfff; text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  width: min(1200px, 96vw);
  margin: 16px auto;
  padding-bottom: 16px;
}

.topbar {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.brand {
  font-weight: 800;
  font-size: 1.2rem;
  word-break: break-word;
}

.card {
  background: linear-gradient(180deg, rgba(17, 27, 52, .88), rgba(12, 20, 41, .9));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  overflow: hidden;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid-2 {
  grid-template-columns: 1fr;
}

@media (min-width: 980px) {
  .grid-2 { grid-template-columns: 2fr 1fr; }
}

.board-wrap {
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #05090f;
  height: min(72vh, 680px);
  position: relative;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  contain: strict;
}

.board-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.board {
  position: relative;
  width: 1000px;
  height: 1000px;
  background-color: #ffffff;
  background-image:
    linear-gradient(to right, rgba(0,0,0,.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,.08) 1px, transparent 1px);
  background-size: 10px 10px;
  transform-origin: 0 0;
  will-change: transform;
}

.area {
  position: absolute;
  border: 1px solid rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.area--reserved { background: #9098a8; }
.area--filled { background: #d0d6e5; }

.area img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.controls {
  display: grid;
  gap: 10px;
}

.row {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, 1fr);
}

.row-4 {
  grid-template-columns: repeat(4, 1fr);
}

input, button, select, textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0c1730;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

input {
  -webkit-text-fill-color: var(--text);
}

input::placeholder,
textarea::placeholder {
  color: #91a4c7;
  opacity: 1;
}

input[type="number"] {
  -moz-appearance: textfield;
  font-variant-numeric: tabular-nums;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

button {
  background: linear-gradient(180deg, #2fd2ba, #1dbd9f);
  color: #05231f;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  background: #1a2747;
  color: #dbe6ff;
}

button.danger {
  background: #5b2432;
  color: #ffdce3;
}

.msg {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.95rem;
}

.msg.ok { background: rgba(67, 214, 136, .16); border: 1px solid rgba(67, 214, 136, .5); }
.msg.err { background: rgba(255, 109, 109, .14); border: 1px solid rgba(255, 109, 109, .45); }

.list {
  display: grid;
  gap: 8px;
}

.list-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(15, 24, 44, 0.85);
}

.muted { color: var(--muted); font-size: .92rem; }
.small { font-size: .84rem; }

.auth-box {
  width: min(560px, 94vw);
  margin: 40px auto;
}

.google-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  border-radius: 10px;
  border: 1px solid #d6d9e0;
  background: #ffffff;
  color: #202124;
  font-weight: 600;
  padding: 10px 12px;
  text-decoration: none;
}

.google-login-btn:hover {
  background: #f8f9fa;
  text-decoration: none;
}

.google-icon {
  display: inline-flex;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4285f4 0%, #34a853 25%, #fbbc05 55%, #ea4335 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.inline { display: flex; gap: 8px; align-items: center; }
.inline > * { flex: 0 0 auto; }

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

.board-actions .muted {
  font-size: 0.8rem;
  max-width: 240px;
  text-align: right;
}

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

.tab-btn {
  border: 1px solid var(--border);
  background: #132341;
  color: #d3e3ff;
  padding: 10px 8px;
  border-radius: 10px;
  font-weight: 700;
}

.tab-btn.is-active {
  background: linear-gradient(180deg, #33d8bf, #1fc2a7);
  color: #03231e;
  border-color: rgba(58, 213, 191, 0.55);
}

.tools-pane {
  display: none;
  gap: 10px;
}

.tools-pane.is-active {
  display: grid;
}

.pay-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 8px;
}

.button-link {
  display: inline-block;
  text-align: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  background: #1a2747;
  font-weight: 700;
}

.button-link:hover {
  text-decoration: none;
}

#psihoPayResult {
  margin-top: 8px;
}

.soon-block {
  display: grid;
  place-items: center;
  min-height: 120px;
  border: 1px dashed rgba(126, 223, 255, 0.35);
  border-radius: 12px;
  color: #7edfff;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.admin-section {
  margin-bottom: 14px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th, .table td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 8px;
  font-size: .9rem;
  vertical-align: top;
}

@media (max-width: 979px) {
  .container {
    width: min(100vw, 100%);
    margin: 0;
    padding: 10px 10px 16px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: linear-gradient(180deg, rgba(8, 12, 24, 0.96), rgba(8, 12, 24, 0.88));
    backdrop-filter: blur(8px);
    padding: 8px 0;
    margin-bottom: 10px;
  }

  .brand {
    font-size: 1rem;
    max-width: 100%;
  }

  .topbar .inline {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .topbar .inline .muted {
    flex: 1 1 100%;
    text-align: left;
  }

  .board-wrap {
    height: min(56vh, 460px);
  }

  .row-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tab-btn {
    min-height: 42px;
    font-size: 0.95rem;
    padding: 8px 6px;
  }

  .board-actions {
    width: 100%;
    justify-content: space-between;
    margin-top: 6px;
  }

  .board-actions .muted {
    max-width: none;
    text-align: left;
    font-size: 0.78rem;
  }
}

@media (max-width: 560px) {
  .card {
    border-radius: 14px;
    padding: 12px;
  }

  .tabs {
    gap: 6px;
  }

  .pay-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .board-wrap {
    height: 52vh;
  }
}
