/* Worldix Clean White Borderless UI (TT Commons Pro) */

.ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.ico svg {
  width: 100%;
  height: 100%;
  display: block;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Hide-HUD toggle state */
#app.is-hud-hidden .hud-top,
#app.is-hud-hidden .hud-top-right,
#app.is-hud-hidden .hud-bottom,
#app.is-hud-hidden .chat-widget,
#app.is-hud-hidden .interact-prompt {
  display: none !important;
}

.hud-restore-btn {
  position: fixed;
  top: 14px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  border: none;
  box-shadow: var(--shadow-flat);
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: background 0.12s ease, color 0.12s ease;
}

.hud-restore-btn:hover {
  background: var(--panel-solid);
  color: var(--ink);
}

/* =========================================================
   Top-Left: Minimal Location Readout
   ========================================================= */
.hud-top {
  position: fixed;
  top: 14px;
  left: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  pointer-events: none;
  user-select: none;
  z-index: 10;
}

.location-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.15;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(15, 23, 42, 0.28);
}

.location-sub {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 8px rgba(15, 23, 42, 0.26);
}

.location-sub .ico {
  width: 14px;
  height: 14px;
}

.depth-tag {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--panel-solid);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
  text-shadow: none;
}

/* =========================================================
   Top-Right: Compact Resources, Server Clock & Actions
   ========================================================= */
.hud-top-right {
  position: fixed;
  top: 14px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  z-index: 12;
}

.resource-strip {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius);
  background: var(--panel);
  border: none;
  box-shadow: var(--shadow-flat);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.res-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.res-item .ico {
  width: 16px;
  height: 16px;
}

.time-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius);
  background: var(--panel);
  border: none;
  box-shadow: var(--shadow-flat);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.time-pill .ico {
  width: 15px;
  height: 15px;
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.timber-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 34px;
  padding: 0 11px;
  border-radius: var(--radius);
  background: var(--panel);
  border: none;
  box-shadow: var(--shadow-flat);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease;
}

.timber-btn:hover {
  background: var(--panel-solid);
}

.timber-btn:active {
  transform: scale(0.96);
}

.timber-btn.is-round {
  width: 34px;
  padding: 0;
}

.timber-btn.is-muted {
  color: var(--ink-dim);
}

.online-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--success);
  font-size: 10.5px;
  font-weight: 700;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

/* =========================================================
   Toast & Context Interaction Prompt
   ========================================================= */
.toast-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  padding: 7px 14px;
  border-radius: var(--radius);
  background: var(--panel-solid);
  border: none;
  box-shadow: var(--shadow-flat);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 30;
  white-space: nowrap;
}

.toast-banner.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.interact-prompt {
  position: fixed;
  left: 50%;
  bottom: 116px;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: var(--radius);
  background: var(--panel-solid);
  border: none;
  box-shadow: var(--shadow-flat);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  z-index: 16;
  transition: background 0.12s ease, color 0.12s ease;
}

.interact-prompt:hover {
  background: var(--ink);
  color: #ffffff;
}

/* =========================================================
   Bottom: Clean White Borderless Hotbar
   ========================================================= */
.hud-bottom {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  user-select: none;
  max-width: calc(100vw - 24px);
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.bench-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 5px;
  border-radius: var(--radius);
  background: var(--panel);
  border: none;
  box-shadow: var(--shadow-flat);
}

.bench-meta[hidden] {
  display: none;
}

.cat-pills {
  display: flex;
  align-items: center;
  gap: 2px;
}

.cat-chip {
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  background: transparent;
  border: none;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.cat-chip:hover {
  background: var(--panel-soft);
  color: var(--ink);
}

.cat-chip.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

.selected-caption {
  padding: 0 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-muted);
  white-space: nowrap;
}

.workbench-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: none;
  box-shadow: var(--shadow-flat);
}

.tool-cluster {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tool-medallion {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.tool-medallion .ico {
  width: 18px;
  height: 18px;
}

.tool-medallion:hover {
  background: var(--panel-soft);
  color: var(--ink);
}

.tool-medallion.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

.tool-medallion.is-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.tool-medallion.is-danger.is-active {
  background: var(--danger);
  color: #ffffff;
}

.timber-shelf {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
}

.pieces-row {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  max-width: min(62vw, 540px);
  scrollbar-width: none;
}

.pieces-row::-webkit-scrollbar {
  display: none;
}

.piece-slot {
  position: relative;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: var(--radius);
  background: var(--panel-soft);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.1s ease;
}

.piece-slot:hover {
  background: var(--panel-hover);
}

.piece-slot.is-selected {
  background: var(--ink);
  transform: translateY(-2px);
}

.piece-slot.is-locked {
  opacity: 0.38;
}

.piece-key {
  position: absolute;
  top: 3px;
  left: 5px;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.piece-slot.is-selected .piece-key {
  color: rgba(255, 255, 255, 0.7);
}

.piece-thumb {
  width: 34px;
  height: 34px;
  object-fit: contain;
  pointer-events: none;
}

.piece-badge-cost {
  position: absolute;
  right: 3px;
  bottom: 2px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.piece-badge-cost .ico {
  width: 10px;
  height: 10px;
}

.roof-swatches {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-left: 6px;
}

.roof-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.roof-swatch:hover {
  transform: scale(1.12);
}

.roof-swatch.is-active {
  transform: scale(1.18);
  box-shadow: 0 0 0 2px var(--ink);
}

/* =========================================================
   Bottom-Left: Minimal White Chat
   ========================================================= */
.chat-widget {
  position: fixed;
  left: 16px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  z-index: 14;
  max-width: 260px;
}

.chat-feed {
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}

.chat-msg {
  padding: 5px 10px;
  border-radius: var(--radius);
  background: var(--panel);
  border: none;
  box-shadow: var(--shadow-flat);
  font-size: 13px;
  line-height: 1.3;
  color: var(--ink);
  word-break: break-word;
}

.chat-msg b {
  font-weight: 700;
  color: var(--ink);
}

.chat-msg.is-system {
  color: var(--ink-muted);
  font-size: 12.5px;
}

.chat-bar {
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-form {
  display: flex;
}

.chat-input {
  width: 190px;
  height: 34px;
  padding: 0 11px;
  border-radius: var(--radius);
  background: var(--panel-solid);
  border: none;
  box-shadow: var(--shadow-flat);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13.5px;
}

.chat-input::placeholder {
  color: var(--ink-dim);
}

/* =========================================================
   Rhythm Mining Ring HUD
   ========================================================= */
.mining-ring-hud {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 136px;
  height: 136px;
  z-index: 22;
  user-select: none;
}

.mining-ring-hud.is-shaking {
  animation: mineRingShake 0.16s ease;
}

@keyframes mineRingShake {
  0%, 100% { transform: translate(-50%, -50%); }
  25% { transform: translate(calc(-50% - 4px), calc(-50% + 2px)); }
  75% { transform: translate(calc(-50% + 4px), calc(-50% - 2px)); }
}

.mining-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.mr-bg {
  fill: rgba(255, 255, 255, 0.92);
  stroke: rgba(17, 24, 39, 0.1);
  stroke-width: 6;
}

.mr-hp {
  fill: none;
  stroke: rgba(17, 24, 39, 0.25);
  stroke-width: 2.5;
  transform: rotate(-90deg);
  transform-origin: 70px 70px;
  transition: stroke-dashoffset 0.1s ease;
}

.mr-good {
  fill: none;
  stroke: var(--success);
  stroke-width: 7;
}

.mr-crit {
  fill: none;
  stroke: #f59e0b;
  stroke-width: 8;
}

.mr-needle {
  stroke: var(--ink);
  stroke-width: 2.2;
}

.mr-needle-tip {
  fill: var(--danger);
}

.mr-center {
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--ink);
  font-family: var(--font-ui);
  cursor: pointer;
}

.mr-combo {
  font-size: 11.5px;
  font-weight: 700;
  color: #d97706;
  font-variant-numeric: tabular-nums;
}

.mr-key {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}

.mr-name {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-muted);
  max-width: 76px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mr-feedback {
  position: absolute;
  left: 50%;
  bottom: -24px;
  transform: translateX(-50%);
  font-size: 12.5px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  text-shadow: 0 1px 6px rgba(15, 23, 42, 0.55);
}

/* =========================================================
   Modals: Clean White Borderless Cards (No Blur)
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 40;
}

.atlas-cover {
  position: relative;
  width: min(410px, 100%);
  max-height: min(520px, 86vh);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  background: var(--panel-solid);
  border: none;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}

.players-cover {
  width: min(370px, 100%);
}

.modal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 8px;
  background: transparent;
  border: none;
}

.modal-topbar-title {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.modal-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.modal-tab {
  height: 30px;
  padding: 0 12px;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  color: var(--ink-muted);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.modal-tab:hover {
  background: var(--panel-soft);
  color: var(--ink);
}

.modal-tab.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

.modal-topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.atlas-close {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  background: var(--panel-soft);
  border: none;
  color: var(--ink-muted);
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.atlas-close:hover {
  background: var(--panel-hover);
  color: var(--ink);
}

.modal-content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.atlas-page {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 14px 14px;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.page-sub {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-dim);
}

.atlas-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-muted);
}

.atlas-input-row {
  display: flex;
  gap: 6px;
}

.atlas-input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 11px;
  border-radius: var(--radius);
  background: var(--panel-soft);
  border: none;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
}

.atlas-input:focus {
  background: var(--panel-hover);
  outline: none;
}

.atlas-input::placeholder {
  color: var(--ink-dim);
}

.atlas-btn {
  height: 36px;
  padding: 0 13px;
  border-radius: var(--radius);
  background: var(--panel-soft);
  border: none;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease;
}

.atlas-btn:hover:not(:disabled) {
  background: var(--panel-hover);
}

.atlas-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.atlas-btn.is-gold {
  background: var(--accent);
  color: var(--accent-ink);
}

.atlas-btn.is-gold:hover:not(:disabled) {
  background: var(--accent-hover);
}

.atlas-btn.is-small {
  height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.atlas-btn.is-danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.atlas-btn.is-danger:hover:not(:disabled) {
  background: var(--danger);
  color: #ffffff;
}

.atlas-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-muted);
  cursor: pointer;
}

.atlas-check input {
  accent-color: var(--ink);
}

.atlas-note-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--panel-soft);
  border: none;
}

.atlas-footer-btns {
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  gap: 6px;
}

.atlas-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  min-height: 0;
}

.atlas-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius);
  background: var(--panel-soft);
  border: none;
}

.atlas-row.is-current {
  background: var(--accent-soft);
}

.row-main {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.row-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.row-sub {
  font-size: 12.5px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

/* Skin swatches */
.skins-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.skin-patch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--panel-soft);
  border: none;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
}

.skin-patch:hover {
  background: var(--panel-hover);
}

.skin-patch.is-selected {
  background: var(--ink);
  color: #ffffff;
}

.skin-dot {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
}

.skin-dot-accent {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

/* Error Banner */
.error-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 420px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: var(--panel-solid);
  border: none;
  box-shadow: var(--shadow-modal);
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  z-index: 60;
}

.atlas-page::-webkit-scrollbar,
.atlas-list::-webkit-scrollbar {
  width: 4px;
}

.atlas-page::-webkit-scrollbar-thumb,
.atlas-list::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 999px;
}

@media (max-width: 760px) {
  .hud-top { top: 10px; left: 10px; }
  .hud-top-right { top: 10px; right: 10px; }
  .time-pill { display: none; }
  .selected-caption { display: none; }
  .chat-widget { bottom: 78px; left: 10px; }
}
