body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #0f1318;
  color: #eee;
}
.admin-page {
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color-scheme: dark;
}
.user-page {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-sizing: border-box;
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: #1b1b1b;
  border-bottom: 1px solid #2e2e2e;
}

.topbar a {
  color: #7db7ff;
}

.top-session-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto;
  flex-wrap: wrap;
  justify-content: center;
}
.areas-semaphore-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
  overflow: hidden;
}

.panel {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
}
.panel.wrap { flex-wrap: wrap; }
.panel.no-pad { padding: 0; }

.grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px 16px;
}

.card {
  background: #171d24;
  border: 1px solid #2a3441;
  border-radius: 12px;
  padding: 14px;
  position: relative;
}

#map {
  height: 68vh;
  width: 100%;
  border-radius: 8px;
}
.user-map-card {
  flex: 1 1 auto;
  margin: 0 16px 16px;
  padding: 10px;
  min-height: 0;
}
.user-map-card #map {
  height: 100%;
}
.map-flash {
  position: absolute;
  inset: 10px;
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  z-index: 860;
}
.map-flash.green {
  background: rgba(46, 214, 108, 0.22);
  animation: mapFlash 960ms ease-out;
}
.map-flash.red {
  background: rgba(227, 66, 66, 0.22);
  animation: mapFlash 960ms ease-out;
}

button, .btn-link {
  background: #2e7dff;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  text-decoration: none;
  cursor: pointer;
}
button:disabled,
input:disabled,
.btn-link.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.danger {
  background: #ca3535;
}
.wide { width: 100%; }

.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px;
}

input {
  width: 100%;
  max-width: 320px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #3a3a3a;
  background: #101010;
  color: #fff;
  margin: 4px 0 8px;
}
.login-wrap { min-height: 100vh; justify-content: center; position: relative; z-index: 2; }
.login-card { width: 100%; max-width: 420px; }
.muted { opacity: 0.8; font-size: 13px; }
.login-page {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(44, 132, 186, 0.32), transparent 45%),
    radial-gradient(circle at 78% 78%, rgba(30, 97, 146, 0.28), transparent 52%),
    #0a141d;
}
.login-bubbles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.login-bubble {
  position: absolute;
  bottom: -120px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.55), rgba(120, 208, 255, 0.18) 55%, rgba(120, 208, 255, 0.05));
  border: 1px solid rgba(180, 234, 255, 0.28);
  box-shadow: inset 0 0 16px rgba(255, 255, 255, 0.16), 0 0 20px rgba(78, 182, 240, 0.18);
  animation: loginBubbleRise linear infinite;
}
.login-bubble.b1 { width: 28px; height: 28px; left: 7%; animation-duration: 10s; animation-delay: 0s; }
.login-bubble.b2 { width: 42px; height: 42px; left: 22%; animation-duration: 13s; animation-delay: 2.2s; }
.login-bubble.b3 { width: 22px; height: 22px; left: 38%; animation-duration: 9s; animation-delay: 1.4s; }
.login-bubble.b4 { width: 54px; height: 54px; left: 61%; animation-duration: 15s; animation-delay: 3.1s; }
.login-bubble.b5 { width: 30px; height: 30px; left: 79%; animation-duration: 11s; animation-delay: 0.8s; }
.login-bubble.b6 { width: 18px; height: 18px; left: 91%; animation-duration: 8s; animation-delay: 4s; }
.login-fish-emoji {
  display: inline-block;
  font-size: 1.5em;
  margin-right: 8px;
  transform-origin: 55% 65%;
  animation: loginFishWiggle 1600ms ease-in-out infinite;
}
@keyframes loginBubbleRise {
  0% { transform: translateY(0) translateX(0) scale(0.9); opacity: 0; }
  12% { opacity: 0.55; }
  50% { transform: translateY(-52vh) translateX(12px) scale(1); opacity: 0.45; }
  100% { transform: translateY(-115vh) translateX(-10px) scale(1.08); opacity: 0; }
}
@keyframes loginFishWiggle {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  18% { transform: rotate(-9deg) translateY(-1px); }
  36% { transform: rotate(8deg) translateY(0); }
  56% { transform: rotate(-6deg) translateY(-1px); }
  74% { transform: rotate(5deg) translateY(0); }
}

.fish {
  font-size: 26px;
  padding: 16px 28px;
  border-radius: 999px;
}
.fish-floating {
  position: relative;
  width: 129px;
  height: 129px;
  border-radius: 50%;
  background: #ffd33d;
  color: #1f1f1f;
  border: 3px solid #fff5b5;
  font-size: 60px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  z-index: 3;
  overflow: hidden;
  animation: fishIdleWobble 1800ms ease-in-out infinite;
}
.fish-floating:hover { background: #ffdf6b; }
.fish-floating::before,
.fish-floating::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.65);
  pointer-events: none;
}
.fish-floating::before {
  width: 10px;
  height: 10px;
  left: 34px;
  bottom: 16px;
  animation: fishBubbleA 1800ms ease-in-out infinite;
}
.fish-floating::after {
  width: 7px;
  height: 7px;
  right: 36px;
  bottom: 24px;
  animation: fishBubbleB 1500ms ease-in-out infinite 300ms;
}
.fish-floating.offline {
  background: #b9b9a7;
  border-color: #d3d3c0;
  color: #505050;
  animation: none;
}
.fish-floating.offline::before,
.fish-floating.offline::after {
  animation: none;
  opacity: 0.2;
}
.fish-floating.session-inactive {
  cursor: not-allowed;
  color: #1f2a33;
  font-size: 22px;
  padding: 18px;
  text-align: center;
  line-height: 1.2;
}
.fish-disabled-text {
  display: inline-block;
  max-width: 90px;
  font-weight: 800;
  letter-spacing: 0.2px;
}
.fish-floating:disabled {
  pointer-events: none;
}
.fish-action-wrap {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 920;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.fish-meta-panel {
  width: min(680px, calc(100vw - 16px));
  border: 1px solid rgba(146, 191, 238, 0.42);
  border-radius: 12px;
  background: rgba(34, 76, 116, 0.33);
  backdrop-filter: blur(8px);
  padding: 10px 12px;
  box-sizing: border-box;
}
.fish-meta-panel input,
.fish-meta-panel textarea {
  max-width: none;
  margin: 0;
}
.fish-meta-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.fish-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.fish-row-label,
.fish-note-label,
.fish-slider-label {
  font-size: 16px;
  font-weight: 700;
  color: #cfe4fb;
  text-align: center;
}
.fish-slider-label {
  display: block;
  text-align: center;
  min-height: 24px;
}
.fish-slider-label > span:first-child {
  display: inline-block;
  width: 100%;
  text-align: center;
}
.fish-gender-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.gender-pill {
  border: 1px solid #355371;
  background: #101926;
  color: #d5e8fb;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 15px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.gender-pill[data-gender="male"] {
  color: #7ec8ff;
}
.gender-pill[data-gender="female"] {
  color: #ff9bd4;
}
.gender-pill .gender-icon {
  font-size: 24px;
  line-height: 1;
}
.gender-pill.is-active[data-gender="male"] {
  border-color: #7ec8ff;
  background: linear-gradient(180deg, #1d5f98, #17486f);
  box-shadow: inset 0 0 0 1px rgba(168, 220, 255, 0.38);
}
.gender-pill.is-active[data-gender="female"] {
  border-color: #ff9bd4;
  background: linear-gradient(180deg, #914771, #6e3558);
  box-shadow: inset 0 0 0 1px rgba(255, 196, 230, 0.38);
}
.fish-row input[type="range"],
.fish-row textarea {
  background: #101926;
  color: #deecfb;
  border: 1px solid #355371;
  border-radius: 8px;
  padding: 8px 9px;
}
.fish-row input[type="range"] {
  padding: 0;
  width: 100%;
  margin: 0;
  display: block;
  accent-color: #aeb8c3;
}
.fish-row input[type="range"].range-active {
  accent-color: #ffffff;
}
.fish-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #5e6a76;
  border: 2px solid #3c4550;
}
.fish-row input[type="range"].range-active::-webkit-slider-thumb {
  background: #ffffff;
  border-color: #b8c3ce;
}
.fish-row input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #5e6a76;
  border: 2px solid #3c4550;
}
.fish-row input[type="range"].range-active::-moz-range-thumb {
  background: #ffffff;
  border-color: #b8c3ce;
}
.fish-row textarea {
  resize: vertical;
  min-height: 74px;
  background: #ffffff;
  color: #111111;
  border-color: #d7e8f7;
}
.fish-decision {
  display: flex;
  gap: 118px;
  align-items: center;
  justify-content: center;
  width: auto;
  align-self: center;
  margin-top: 4px;
}
.mini-action {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  font-size: 44px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}
.mini-undo {
  background: #d53535;
  color: #fff;
  flex-direction: column;
  gap: 2px;
  line-height: 1;
}
.mini-confirm {
  background: #36c86c;
  color: #fff;
  font-size: 64px;
}
.mini-action.pulse {
  animation: decisionPulse 420ms ease;
}
.mini-action.enter {
  animation: decisionEnter 220ms ease-out;
}
.hidden { display: none !important; }
@keyframes decisionEnter {
  0% { transform: translateY(8px) scale(0.92); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes decisionPulse {
  0% { transform: scale(0.88); }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
@keyframes fishIdleWobble {
  0% { transform: rotate(0deg) scale(1); }
  20% { transform: rotate(-5deg) scale(1.03); }
  40% { transform: rotate(5deg) scale(1.03); }
  60% { transform: rotate(-3deg) scale(1.02); }
  80% { transform: rotate(3deg) scale(1.01); }
  100% { transform: rotate(0deg) scale(1); }
}
@keyframes fishBubbleA {
  0% { transform: translateY(0) scale(0.8); opacity: 0; }
  25% { opacity: 0.8; }
  100% { transform: translateY(-48px) scale(1.15); opacity: 0; }
}
@keyframes fishBubbleB {
  0% { transform: translateY(0) scale(0.7); opacity: 0; }
  30% { opacity: 0.7; }
  100% { transform: translateY(-38px) scale(1.1); opacity: 0; }
}
.center-popup {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 950;
  width: auto;
  height: auto;
  font-size: 117px;
  line-height: 1;
  background: transparent;
  border: none;
  box-shadow: none;
  pointer-events: none;
  text-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
}
.center-popup::before,
.center-popup::after {
  content: "💦";
  position: absolute;
  font-size: 45px;
  opacity: 0;
}
.center-popup::before {
  left: -39px;
  top: 12px;
}
.center-popup::after {
  right: -42px;
  top: -6px;
}
.center-popup.pop {
  animation: popupCore 980ms ease;
}
.center-popup.pop::before {
  animation: popupSplashLeft 980ms ease;
}
.center-popup.pop::after {
  animation: popupSplashRight 980ms ease;
}
@keyframes popupCore {
  0% { transform: translate(-50%, -50%) scale(0.55); opacity: 0; }
  24% { transform: translate(-50%, -50%) scale(1.08); opacity: 1; }
  100% { transform: translate(-50%, -62%) scale(1.02); opacity: 0; }
}
@keyframes popupSplashLeft {
  0% { transform: translate(6px, 8px) scale(0.6) rotate(0deg); opacity: 0; }
  22% { opacity: 1; }
  100% { transform: translate(-18px, -24px) scale(1.1) rotate(-14deg); opacity: 0; }
}
@keyframes popupSplashRight {
  0% { transform: translate(-6px, 8px) scale(0.6) rotate(0deg); opacity: 0; }
  22% { opacity: 1; }
  100% { transform: translate(20px, -26px) scale(1.1) rotate(14deg); opacity: 0; }
}
@keyframes mapFlash {
  0% { opacity: 0; }
  20% { opacity: 1; }
  100% { opacity: 0; }
}

.error {
  color: #ff8d8d;
}

ul {
  margin: 0;
  padding-left: 20px;
}

.start-btn, .resume-btn, .stop-btn, .clear-btn { font-size: 20px; font-weight: 700; padding: 14px 26px; border-radius: 12px; }
.start-btn { background: #18a44b; }
.resume-btn { background: #d58a25; }
.stop-btn { background: #d53535; }
.clear-btn { background: #111111; border: 1px solid #3a3a3a; }

.semaphore {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 9px 14px;
  border: 1px solid #3a3a3a;
  font-weight: 700;
  min-width: 210px;
}
.semaphore .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.semaphore.stopped {
  background: rgba(213, 53, 53, 0.15);
  border-color: #7e2b2b;
  color: #ff8f8f;
}
.semaphore.stopped .dot { background: #d53535; box-shadow: 0 0 12px #d53535; }
.semaphore.running {
  background: rgba(24, 164, 75, 0.15);
  border-color: #267648;
  color: #9df3bf;
}
.semaphore.running .dot { background: #18a44b; box-shadow: 0 0 12px #18a44b; }
.small-semaphore { min-width: 140px; }
.areas-semaphore-list .small-semaphore {
  max-width: min(36vw, 260px);
}
.areas-semaphore-list .small-semaphore .label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  background: #253246;
  color: #e8f1ff !important;
  border: 1px solid #3b4e66;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
}
.logout-btn:hover { background: #2f425b; }

.tabs {
  display: flex;
  gap: 10px;
  padding: 10px 16px 0;
  background: linear-gradient(180deg, #141b23, #10161d);
  border-bottom: 1px solid #2b3d52;
}
.tab-btn {
  position: relative;
  background: linear-gradient(180deg, #223244, #1c2938);
  color: #afc8e5;
  border: 1px solid #34475e;
  border-bottom: 1px solid #2b3d52;
  border-radius: 12px 12px 0 0;
  padding: 10px 16px;
  font-weight: 700;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 120ms ease;
}
.tab-btn:hover {
  background: linear-gradient(180deg, #2b3e54, #243346);
  border-color: #4f6e93;
  transform: translateY(-1px);
  color: #d5e8ff;
}
.tab-btn.active {
  background: linear-gradient(180deg, #2f445d, #26384c);
  color: #e8f3ff;
  border-color: #6d92bb;
  border-bottom-color: transparent;
  box-shadow: 0 -1px 0 #8ab6e3 inset, 0 8px 16px rgba(9, 22, 39, 0.3);
  transform: translateY(1px);
}
.tab-btn.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 3px;
  background: #26384c;
}
.tab-page {
  display: none;
  padding: 12px 16px 16px;
  flex: 1 1 auto;
  min-height: 0;
  border-top: 1px solid #6d92bb;
  background: linear-gradient(180deg, #111923 0%, #0f161f 100%);
}
.tab-page.active {
  display: block;
}

#mapTab.active {
  display: flex;
  flex-direction: column;
}

#usersTab.active,
#playerTab.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.users-tab-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.users-add-card {
  flex-shrink: 0;
  padding: 14px 16px 16px;
  background: linear-gradient(165deg, rgba(30, 46, 64, 0.88), rgba(18, 27, 38, 0.94));
  border-color: #364c63;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 6px 22px rgba(0, 0, 0, 0.22);
}

.users-add-head {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(42, 58, 78, 0.85);
}

.users-add-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 800;
  color: #e8f3ff;
  letter-spacing: 0.02em;
}

.users-add-lede {
  margin: 0;
  max-width: 52rem;
  font-size: 13px;
  line-height: 1.45;
  color: #a9bfd7;
}

.users-add-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.users-add-bar .users-form-input {
  flex: 1 1 0;
  min-width: 0;
  width: 0; /* with flex-basis 0, lets fields share space and truly fill the row */
}

.users-form-input {
  box-sizing: border-box;
  margin: 0;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.25;
  background: #111c28;
  border: 1px solid #3d5066;
  border-radius: 10px;
  color: #e8f1ff;
}

.users-form-input::placeholder {
  color: #6a7f95;
}

.users-form-input:focus {
  outline: none;
  border-color: #6d92bb;
  box-shadow: 0 0 0 2px rgba(109, 146, 187, 0.35);
}

.users-add-btn {
  flex: 0 0 auto;
  align-self: stretch;
  min-width: 8.5rem;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  border-radius: 10px;
  background: linear-gradient(180deg, #368fff, #2f73df);
  border: 1px solid #83beff;
  box-sizing: border-box;
  white-space: nowrap;
}

.users-add-btn:hover {
  background: linear-gradient(180deg, #4a9cff, #377de9);
}

.users-main-zone {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  padding: 12px 14px 14px;
  background: linear-gradient(165deg, rgba(24, 36, 50, 0.92), rgba(15, 22, 31, 0.95));
  border-color: #304155;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 8px 28px rgba(0, 0, 0, 0.25);
}

.users-main-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(42, 58, 78, 0.9);
}
.users-search-row {
  margin-bottom: 10px;
}
.users-search-input {
  width: 100%;
  max-width: none;
}

.users-main-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #e8f3ff;
  letter-spacing: 0.02em;
}

.users-count-badge {
  font-size: 12px;
  font-weight: 700;
  color: #bcd8f6;
  background: rgba(38, 58, 82, 0.65);
  border: 1px solid #456183;
  border-radius: 999px;
  padding: 5px 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.users-table-scroll {
  flex: 1 1 auto;
  min-height: 180px;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid #2a3a4d;
  background: rgba(10, 15, 22, 0.5);
  scrollbar-width: thin;
  scrollbar-color: #6a8fb8 #1a2634;
}

.users-table-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.users-table-scroll::-webkit-scrollbar-track {
  background: #1a2634;
  border-radius: 0 10px 10px 0;
}

.users-table-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #7da9d8, #567ea7);
  border-radius: 999px;
  border: 2px solid #1a2634;
}

.admin-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 290px;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
}
.left-tools, .right-tools {
  min-height: 0;
  overflow: auto;
}
.map-zone {
  padding: 10px;
  min-height: 0;
  display: flex;
}
.map-zone #map {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}
/* Small inset so selected polygon stroke has a bit of room inside the clipped map box */
.admin-page .map-zone #map {
  padding: 4px;
  box-sizing: border-box;
}
.replay-controls {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 650;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(13, 20, 28, 0.9);
  border: 1px solid #3c5168;
  backdrop-filter: blur(3px);
  max-width: calc(100% - 36px);
}
.replay-controls label {
  font-size: 12px;
  color: #cde4ff;
}
.replay-controls select {
  background: #172332;
  color: #fff;
  border: 1px solid #365172;
  border-radius: 8px;
  padding: 6px 8px;
}
.replay-icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  font-size: 15px;
  line-height: 1;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.replay-close-btn {
  margin-left: 4px;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
  background: #c53b3b;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#replayTimeline {
  width: min(36vw, 420px);
  margin: 0;
}
#replayTimeLabel {
  min-width: 72px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #d8ebff;
  font-size: 12px;
}
.right-tools { display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.area-slots-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.area-slot-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}
.selected-area-placeholder {
  padding-bottom: 10px;
  border-bottom: 1px solid #2a3441;
}
.selected-area-placeholder:has(> .selected-area-panel.hidden) {
  padding-bottom: 0;
  border-bottom: none;
}
/* Primary selection affordance: highlight editor slot (not thick map stroke) */
.selected-area-placeholder:has(> .selected-area-panel:not(.hidden)) {
  padding: 10px 10px 12px;
  margin: 2px 0 8px;
  border-radius: 10px;
  border: 1px solid rgba(93, 185, 255, 0.55);
  background: linear-gradient(165deg, rgba(42, 72, 108, 0.55), rgba(22, 34, 48, 0.72));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 1px rgba(20, 35, 52, 0.9),
    0 4px 18px rgba(40, 120, 200, 0.18);
  border-bottom: 1px solid rgba(70, 130, 190, 0.45);
}
.selected-area-panel {
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}
#selectedAreaCard.hidden { display: none; }
.area-form-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 10px;
  align-items: center;
}
.area-field-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #a9c3de;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  line-height: 1.2;
}
#selectedAreaCard .area-name-input,
#selectedAreaCard input[type="color"] {
  width: 100%;
  max-width: none;
  min-width: 0;
  box-sizing: border-box;
  margin: 0;
}
#selectedAreaCard .area-name-input {
  padding: 5px 8px;
  font-size: 13px;
  line-height: 1.25;
}
.area-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
#selectedAreaCard input[type="color"] {
  height: 30px;
  border-radius: 8px;
  border: 1px solid #3d5066;
  background: #111c28;
  padding: 2px;
  cursor: pointer;
}
.area-actions-row {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.area-action-save,
.area-action-delete {
  border-radius: 8px;
  font-weight: 700;
  letter-spacing: 0.2px;
  padding: 7px 10px;
  font-size: 13px;
  width: 100%;
}
.area-action-save {
  background: linear-gradient(180deg, #368fff, #2f73df);
  border: 1px solid #83beff;
}
.area-action-save:hover {
  background: linear-gradient(180deg, #4a9cff, #377de9);
}
.area-action-feedback {
  margin: 10px 0 0;
  border-radius: 9px;
  border: 1px solid #4a627a;
  background: rgba(26, 39, 53, 0.75);
  color: #cfe5ff;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
}
.area-action-feedback.ok {
  border-color: #4f9f79;
  background: rgba(28, 66, 48, 0.62);
  color: #bff4d8;
}
.area-action-feedback.warn {
  border-color: #8874b8;
  background: rgba(52, 39, 84, 0.58);
  color: #e6dcff;
}
.area-action-feedback.err {
  border-color: #9d5353;
  background: rgba(79, 34, 34, 0.62);
  color: #ffc8c8;
}
#legendCard { flex: 1; overflow: auto; }
.left-tools {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.left-tools-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.areas-bottom-actions {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #2a3441;
}
.areas-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.action-btn {
  width: 100%;
  text-align: center;
  box-sizing: border-box;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 600;
}
.hidden-file {
  display: none;
}
#areaSlots {
  overflow: visible;
}
.slot-row {
  width: 100%;
  text-align: left;
  margin-bottom: 6px;
  background: #202c3a;
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid transparent;
  box-sizing: border-box;
}
.slot-row.selected {
  outline: none;
  border: 1px solid rgba(93, 185, 255, 0.75);
  box-shadow:
    inset 0 0 0 1px rgba(130, 191, 255, 0.25),
    0 0 12px rgba(60, 150, 230, 0.22);
  background: linear-gradient(180deg, #2a3d52, #243447);
}
.slot-row.slot-add {
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  margin-bottom: 6px;
  background: #1f2b37;
  font-weight: 700;
  transition: opacity 180ms ease, filter 180ms ease, background 180ms ease;
}
.legend-item.locked { background: #2e7dff; }
.legend-item.offline {
  background: #2a3037;
  color: #b8c2cc;
  filter: grayscale(0.55);
  opacity: 0.74;
}
.legend-item.offline .legend-fish-count {
  background: rgba(66, 74, 84, 0.7);
  border-color: #586576;
  color: #d4dee9;
}
.legend-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.legend-admin-star {
  color: #ffd766;
  font-size: 15px;
  line-height: 1;
  text-shadow: 0 0 10px rgba(255, 215, 102, 0.45);
}
.legend-fish-count {
  font-size: 12px;
  color: #d5e9ff;
  background: rgba(38, 58, 82, 0.7);
  border: 1px solid #456183;
  border-radius: 999px;
  padding: 2px 8px;
  font-variant-numeric: tabular-nums;
}
.legend-toggles {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid #304257;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(35, 50, 66, 0.58), rgba(24, 35, 47, 0.58));
}
.legend-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: #d8e9fb;
  cursor: pointer;
}
.legend-toggle-label {
  font-weight: 600;
}
.legend-switch {
  position: relative;
  width: 36px;
  height: 20px;
  display: inline-flex;
}
.legend-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.legend-switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #334657;
  border: 1px solid #4a627a;
  transition: background 160ms ease, border-color 160ms ease;
}
.legend-switch-slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: #c8d7e7;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 160ms ease, background 160ms ease;
}
.legend-switch input:checked + .legend-switch-slider {
  background: #2f86e7;
  border-color: #86bcff;
}
.legend-switch input:checked + .legend-switch-slider::before {
  transform: translateX(16px);
  background: #ffffff;
}
.legend-switch input:focus-visible + .legend-switch-slider {
  outline: 2px solid rgba(130, 191, 255, 0.75);
  outline-offset: 2px;
}

.legend-icon {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.map-user-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45), 0 4px 10px rgba(0, 0, 0, 0.45);
}
.map-user-icon.offline {
  opacity: 0.48;
  filter: grayscale(0.85) saturate(0.5);
  border-color: rgba(235, 240, 245, 0.72);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.38), 0 2px 6px rgba(0, 0, 0, 0.35);
}

.users-table { width: 100%; border-collapse: collapse; margin: 0; }
.users-table {
  border: none;
  border-radius: 0;
  overflow: visible;
  background: linear-gradient(180deg, #121922, #101721);
}
.users-table th,
.users-table td {
  border-bottom: 1px solid #2a3441;
  padding: 10px 9px;
  text-align: left;
}
.users-table thead th {
  background: #1b2734;
  color: #bcd8f6;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.users-table-scroll .users-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 #2a3441;
}
.users-table tbody tr:hover {
  background: rgba(52, 85, 123, 0.22);
}
.users-table td:last-child { vertical-align: middle; }
.users-actions-wrap {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.users-disabled-action {
  background: transparent !important;
  color: #d38f8f !important;
  border: 1px solid #9b5a5a !important;
  box-shadow: none;
  opacity: 0.72;
  cursor: not-allowed;
}
.users-pass-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px;
  align-items: center;
  gap: 8px;
}
.users-pass-row .small-pass {
  max-width: none;
  width: 100%;
  min-width: 0;
}
.users-pass-row button {
  width: 108px;
  margin: 0;
  white-space: nowrap;
  padding: 7px 8px;
  font-size: 12px;
}
.users-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.users-name-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
}
.users-name-icon.is-admin {
  color: #ffe38a;
  background: rgba(108, 88, 28, 0.45);
}
.users-name-icon.is-user {
  color: #d8ecff;
  background: rgba(53, 94, 138, 0.45);
}
.users-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
}
.users-role-text {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: lowercase;
  color: #d5e9ff;
  background: rgba(50, 78, 108, 0.5);
  border: 1px solid rgba(96, 140, 186, 0.55);
}
.small-pass { max-width: 180px; margin: 0; flex: 1 1 140px; min-width: 120px; }
.ok { color: #69e48e; font-weight: 700; }
.ko { color: #ff7a7a; font-weight: 700; }
.history-card {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}
.history-card h2 {
  margin-top: 0;
  color: #d7e8fc;
}
.history-sections {
  display: grid;
  gap: 12px;
}
.history-section {
  padding: 12px;
  border-color: #304155;
  background: linear-gradient(180deg, rgba(29, 44, 60, 0.55), rgba(19, 30, 41, 0.55));
}
.history-section h3 {
  margin: 0 0 6px;
  color: #d2e5fb;
  display: flex;
  align-items: center;
  gap: 8px;
}
.history-icon {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(64, 114, 167, 0.32);
  border: 1px solid rgba(120, 167, 219, 0.54);
  font-size: 14px;
}
.history-copy {
  margin: 0 0 10px;
  color: #b9cce2;
  font-size: 13px;
  line-height: 1.45;
}
.history-section.is-disabled {
  opacity: 0.58;
  filter: saturate(0.55);
}
.history-card .panel {
  padding: 12px;
  border: 1px solid #2d3c4e;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(30, 44, 60, 0.65), rgba(21, 31, 42, 0.65));
}
.history-card .panel .btn-link {
  background: #33537a;
}
.history-card .panel.wrap {
  gap: 8px;
}
.history-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
}

hr { border: none; border-top: 1px solid #2a3441; margin: 12px 0; }

.user-fish-log-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  width: fit-content;
  min-width: 250px;
  max-width: min(92vw, 760px);
  z-index: 1200;
  background: rgba(12, 18, 27, 0.88);
  border: 1px solid #3f5f84;
  border-radius: 12px;
  padding: 10px;
  backdrop-filter: blur(4px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}
.user-page.fish-log-expanded .fish-action-wrap {
  opacity: 0;
  pointer-events: none;
}
.user-fish-log-overlay.collapsed {
  min-width: 0;
  max-width: min(92vw, 760px);
}
.fish-log-toggle {
  all: unset;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(47, 81, 121, 0.5), rgba(28, 48, 72, 0.4));
  border: 1px solid rgba(134, 176, 226, 0.42);
  border-radius: 10px;
  padding: 11px 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  color: #d8ebff;
  letter-spacing: 0.15px;
}
.fish-log-toggle:hover {
  background: linear-gradient(180deg, rgba(62, 103, 150, 0.56), rgba(34, 57, 85, 0.45));
}
.fish-log-toggle-icon {
  font-size: 17px;
  transition: transform 180ms ease;
}
.user-fish-log-overlay:not(.collapsed) .fish-log-toggle-icon {
  transform: rotate(180deg);
}
.fish-log-list {
  margin-top: 8px;
  max-height: min(72vh, calc(100dvh - 170px));
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: #6a8fb8 #1a2634;
}
.fish-log-item {
  display: grid;
  grid-template-columns: 26px 66px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  white-space: nowrap;
  background: linear-gradient(180deg, #1c2836, #162230);
  border: 1px solid #3a4e64;
  border-radius: 9px;
  padding: 7px 8px;
  color: #d5e6fa;
}
.fish-log-item .fish-log-meta {
  grid-column: 2 / -1;
  font-size: 11px;
  color: #a9bfd7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fish-log-list::-webkit-scrollbar {
  width: 10px;
}
.fish-log-list::-webkit-scrollbar-track {
  background: #1a2634;
  border-radius: 999px;
}
.fish-log-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #7da9d8, #567ea7);
  border-radius: 999px;
  border: 2px solid #1a2634;
}
.fish-log-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #90bbe8, #628bb6);
}
.fish-log-item .fish-icon {
  text-align: center;
  font-size: 15px;
}
.fish-log-item .fish-time {
  color: #9cc7f8;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.fish-log-item .fish-areas {
  overflow: hidden;
  text-overflow: ellipsis;
  color: #c6daf2;
}
.fish-log-item .fish-pos {
  color: #8ba3bc;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.fish-log-empty {
  font-size: 12px;
  color: #b6cade;
  background: #1a2531;
  border: 1px dashed #3c536d;
  border-radius: 9px;
  padding: 8px 10px;
}

/* Admin replay: keep controls visible; block interaction outside map + replay bar */
body.admin-replay-active #mapTab .left-tools,
body.admin-replay-active #mapTab .right-tools,
body.admin-replay-active #mapTab .areas-bottom-actions {
  pointer-events: none;
  opacity: 0.55;
  filter: grayscale(0.12);
}

/* Admin player tab — matches users/history density, fills viewport */
.player-tab-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 0;
  min-height: 0;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.player-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.player-inspector-toolbar {
  flex-shrink: 0;
  padding: 12px 14px 14px;
  background: linear-gradient(165deg, rgba(30, 46, 64, 0.88), rgba(18, 27, 38, 0.94));
  border-color: #364c63;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 6px 22px rgba(0, 0, 0, 0.22);
}

.player-inspector-head-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  min-width: 0;
}

.player-inspector-heading {
  flex: 1 1 auto;
  min-width: 0;
}

.player-inspector-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #e8f3ff;
  letter-spacing: 0.02em;
}

.player-inspector-select-wrap {
  flex: 0 1 220px;
  min-width: min(220px, 100%);
}

.player-inspector-select {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 9px 11px;
  font-size: 14px;
  line-height: 1.25;
  border-radius: 10px;
  border: 1px solid rgba(58, 78, 102, 0.95);
  background-color: #141c28;
  background-image: linear-gradient(180deg, #141c28, #101820);
  color: #e8f0fa;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  /* Native dropdown list: avoid light panel + inherited light text (Windows/Chrome). */
  color-scheme: dark;
}

.player-inspector-select option,
.player-inspector-select optgroup {
  background-color: #1a2432;
  color: #e8f0fa;
}

.player-inspector-select:focus {
  outline: none;
  border-color: #5c9ae6;
  box-shadow: 0 0 0 2px rgba(92, 154, 230, 0.25);
}

.player-inspector-main {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr minmax(240px, 300px);
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  overflow: hidden;
  align-items: stretch;
  background: linear-gradient(165deg, rgba(24, 36, 50, 0.55), rgba(16, 24, 34, 0.75));
  border-color: #364c63;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 8px 28px rgba(0, 0, 0, 0.2);
}

.player-inspector-map-wrap {
  position: relative;
  min-height: 0;
  min-width: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(42, 58, 78, 0.95);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.player-inspector-map-wrap #playerMap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  width: 100% !important;
  height: 100% !important;
  min-height: 0;
  border-radius: 0;
}

.player-fish-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  min-width: 0;
  padding: 10px 11px 12px;
  background: linear-gradient(180deg, rgba(29, 44, 60, 0.72), rgba(19, 30, 41, 0.88));
  border: 1px solid rgba(48, 65, 85, 0.9);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.player-fish-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(42, 58, 78, 0.85);
}

.player-fish-sidebar-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: #d2e5fb;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.player-fish-refresh {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(120, 167, 219, 0.5);
  background: linear-gradient(145deg, rgba(64, 114, 167, 0.35), rgba(36, 58, 88, 0.55));
  color: #d7eaff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.player-fish-refresh:hover {
  border-color: rgba(147, 196, 255, 0.75);
  background: linear-gradient(145deg, rgba(80, 132, 190, 0.45), rgba(42, 72, 108, 0.65));
  color: #fff;
}

.player-fish-refresh:active {
  transform: scale(0.94);
}

.player-fish-list {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 4px 4px 2px;
}

.player-fish-list::-webkit-scrollbar {
  width: 8px;
}
.player-fish-list::-webkit-scrollbar-thumb {
  background: rgba(100, 140, 188, 0.45);
  border-radius: 999px;
}

.player-fish-item {
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid rgba(46, 61, 80, 0.95);
  background: rgba(22, 32, 44, 0.65);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
}

.player-fish-item.is-open {
  border-color: rgba(92, 200, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(92, 200, 255, 0.2);
}

.player-fish-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #e8f0fa;
  cursor: pointer;
  font: inherit;
  box-sizing: border-box;
}

.player-fish-item.is-open .player-fish-row {
  border-radius: 10px 10px 0 0;
  background: rgba(26, 37, 49, 0.9);
  border-bottom: 1px solid rgba(42, 58, 78, 0.75);
}

.player-fish-row:hover {
  background: rgba(40, 58, 78, 0.35);
}

.player-fish-item.is-open .player-fish-row:hover {
  background: rgba(26, 37, 49, 0.95);
}

.player-fish-item.is-open .player-fish-row-time {
  color: #c8e8ff;
}

.player-fish-row-icon {
  font-size: 1.2rem;
  line-height: 1;
}
.player-fish-row-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.player-fish-row-time {
  font-weight: 700;
  font-size: 14px;
}
.player-fish-row-meta {
  font-size: 12px;
  color: #9fb3c8;
  word-break: break-word;
}

.player-fish-expand {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(14, 22, 32, 0.92);
  border-top: 1px solid rgba(42, 58, 78, 0.5);
}

.player-fish-expand-title {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8eb4d4;
}

.player-edit-label {
  font-size: 12px;
  color: #a8b5c4;
}
.player-edit-input,
.player-edit-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(58, 74, 94, 0.95);
  background: linear-gradient(180deg, #141c28, #101820);
  color: #fff;
  max-width: none;
  margin: 0;
  font-size: 14px;
  font-family: inherit;
}

.player-edit-actions-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.player-edit-actions-split .player-editor-feedback {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 4px;
}

.player-fish-action-btn {
  margin: 0;
  padding: 11px 12px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1.2;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  transition: filter 0.12s ease, transform 0.1s ease;
}

.player-fish-action-btn:active {
  transform: scale(0.98);
}

.player-fish-action-save {
  background: #2e7dff;
  color: #fff;
}

.player-fish-action-save:hover {
  filter: brightness(1.08);
}

.player-fish-action-delete {
  background: #ca3535;
  color: #fff;
}

.player-fish-action-delete:hover {
  filter: brightness(1.08);
}

.player-editor-feedback {
  font-size: 13px;
  margin: 0;
}

.player-editor-feedback.ok {
  color: #6dffb4;
}

.player-editor-feedback.err {
  color: #ff8a8a;
}

@media (max-width: 820px) {
  .admin-page {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }
  #map {
    min-height: 74vh;
  }
  .admin-layout {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .admin-layout .map-zone {
    order: 1;
    min-height: 74vh;
    padding: 8px;
  }
  .admin-layout .left-tools {
    order: 2;
  }
  .admin-layout .right-tools {
    order: 3;
  }
  .left-tools.card {
    padding: 10px;
  }
  .left-tools-scroll h3 {
    margin: 0 0 8px;
    font-size: 14px;
  }
  .selected-area-placeholder {
    padding-bottom: 6px;
  }
  .selected-area-placeholder:has(> .selected-area-panel:not(.hidden)) {
    padding: 8px 8px 9px;
    margin: 0 0 6px;
  }
  #selectedAreaCard .area-name-input {
    padding: 4px 7px;
    font-size: 12px;
  }
  #selectedAreaCard input[type="color"] {
    height: 26px;
  }
  .area-actions-row {
    margin-top: 8px;
    gap: 6px;
  }
  .area-action-save,
  .area-action-delete {
    padding: 6px 8px;
    font-size: 12px;
  }
  .slot-row {
    margin-bottom: 4px;
    padding: 6px 8px;
    font-size: 12px;
  }
  .admin-page .topbar {
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }
  .admin-page .topbar h1 {
    width: auto;
    margin: 0;
    font-size: 0.98rem;
    white-space: nowrap;
    flex: 0 1 auto;
  }
  .admin-page .top-session-controls {
    margin: 0;
    justify-content: center;
    flex: 1 1 auto;
    min-width: 0;
    gap: 6px;
    flex-wrap: nowrap;
    overflow: hidden;
  }
  .admin-page .logout-btn {
    margin-left: auto;
    flex: 0 0 auto;
  }
  .tabs {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }
  .tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .users-tab-stack {
    max-width: none;
  }
  .users-add-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: stretch;
  }
  .users-add-bar .users-form-input {
    width: 100%;
    min-width: 0;
  }
  .users-add-btn {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }
  .users-main-zone {
    min-height: 260px;
  }
  .users-table-scroll {
    min-height: 200px;
  }
  .users-table {
    min-width: 0;
    border-spacing: 0;
    background: transparent;
  }
  .users-table thead {
    display: none;
  }
  .users-table tbody,
  .users-table tr,
  .users-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }
  .users-table tbody tr {
    margin: 0 0 10px;
    border: 1px solid #33475e;
    border-radius: 10px;
    background: linear-gradient(180deg, #152131, #101926);
    padding: 8px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "user role status"
      "pass pass pass"
      "delete delete delete";
    gap: 6px 8px;
  }
  .users-table tbody tr td:nth-child(1) { grid-area: user; font-weight: 800; }
  .users-table tbody tr td:nth-child(2) { grid-area: role; text-align: right; }
  .users-table tbody tr td:nth-child(3) { grid-area: pass; }
  .users-table tbody tr td:nth-child(4) { grid-area: status; text-align: right; }
  .users-table tbody tr td:nth-child(5) { grid-area: delete; }
  .users-table td {
    border: 0;
    border-bottom: none;
    padding: 4px 2px;
    text-align: left;
  }
  .users-table td::before {
    content: none;
  }
  .users-table td[data-label="Azioni"] {
    display: flex;
    justify-content: center;
    gap: 8px;
    align-items: center;
  }
  .users-table td[data-label="Azioni"] .users-actions-wrap {
    display: inline-flex;
    justify-content: center;
    width: 100%;
  }
  .users-table td[data-label="Stato"] .ok,
  .users-table td[data-label="Stato"] .ko { white-space: nowrap; }
  .users-table td[data-label="Ruolo"] { white-space: nowrap; }
  .users-table .users-pass-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 108px;
    gap: 8px;
    align-items: center;
  }
  .users-table .users-pass-row button {
    width: 108px;
    padding: 7px 8px;
    font-size: 12px;
  }
  .users-table .users-pass-row button {
    white-space: nowrap;
  }
  .users-table .small-pass {
    max-width: none;
    min-width: 0;
    width: 100%;
  }
  .left-tools,
  .right-tools {
    min-height: auto;
    overflow: visible;
  }
  .map-zone {
    overflow: visible;
  }
  .fish-action-wrap {
    bottom: 12px;
    gap: 12px;
  }
  .fish-meta-panel {
    width: min(520px, calc(100vw - 16px));
  }
  .fish-floating {
    width: 156px;
    height: 156px;
    font-size: 74px;
  }
  .mini-action {
    width: 156px;
    height: 156px;
    font-size: 52px;
  }
  .mini-confirm {
    font-size: 88px;
  }
  .fish-decision {
    gap: 22px;
  }

  .user-fish-log-overlay {
    top: 8px;
    right: 8px;
    left: 8px;
    width: auto;
    max-width: none;
  }
  .fish-log-toggle {
    padding: 13px 14px;
    font-size: 17px;
  }
  .fish-log-toggle-icon {
    font-size: 19px;
  }
  .user-fish-log-overlay:not(.collapsed) {
    bottom: 8px;
    display: flex;
    flex-direction: column;
  }
  .fish-log-list {
    flex: 1 1 auto;
    max-height: none;
    min-height: 0;
  }

  .player-tab-stack {
    max-width: none;
  }
  .player-inspector-head-row {
    flex-wrap: wrap;
  }
  .player-inspector-select-wrap {
    flex: 1 1 100%;
    max-width: none;
  }
  .player-inspector-main {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(200px, 38vh) minmax(180px, 1fr);
    flex: 1 1 auto;
  }
}

@media (max-width: 600px) {
  .admin-page .topbar {
    padding-top: max(10px, env(safe-area-inset-top, 10px));
    padding-left: max(12px, env(safe-area-inset-left, 12px));
    padding-right: max(12px, env(safe-area-inset-right, 12px));
  }
  .admin-page .top-session-controls .start-btn,
  .admin-page .top-session-controls .resume-btn,
  .admin-page .top-session-controls .stop-btn,
  .admin-page .top-session-controls .clear-btn {
    font-size: 12px;
    padding: 7px 8px;
    border-radius: 8px;
  }
  .admin-page .semaphore {
    min-width: 0;
    width: auto;
    padding: 6px 8px;
    font-size: 11px;
    gap: 5px;
  }
  .user-page .topbar {
    flex-wrap: nowrap;
    align-items: center;
    padding-top: max(10px, env(safe-area-inset-top, 10px));
    padding-left: max(12px, env(safe-area-inset-left, 12px));
    padding-right: max(12px, env(safe-area-inset-right, 12px));
    gap: 8px;
    min-width: 0;
  }
  .user-page .topbar h1 {
    font-size: 0.86rem;
    width: auto;
    margin: 0;
    white-space: nowrap;
    flex: 0 1 auto;
  }
  .user-page .top-session-controls {
    flex: 1 1 auto;
    justify-content: center;
    margin: 0;
    min-width: 0;
    gap: 5px;
    flex-wrap: nowrap;
    overflow: hidden;
  }
  .user-page .top-session-controls .semaphore {
    min-width: 0;
    width: auto;
    padding: 6px 8px;
    font-size: 11px;
    gap: 5px;
  }
  .user-page .logout-btn {
    padding: 7px 9px;
    border-radius: 8px;
    font-size: 12px;
    flex: 0 0 auto;
  }
  .user-map-card {
    margin-left: max(10px, env(safe-area-inset-left, 10px));
    margin-right: max(10px, env(safe-area-inset-right, 10px));
    margin-bottom: max(10px, env(safe-area-inset-bottom, 10px));
  }
  .fish-action-wrap {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .fish-meta-panel {
    width: min(680px, calc(100vw - max(24px, env(safe-area-inset-left) + env(safe-area-inset-right, 0px))));
  }
}

