/* 浮层：注册弹窗、toast */

/* ---------------------------------------------------------------- 弹窗 */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(43, 31, 22, 0.34);
  backdrop-filter: blur(3px);
}

.modal[hidden] {
  display: none;
}

.dialog {
  width: min(380px, 100%);
  padding: 26px 24px 22px;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: center;
}

.dialog-icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  margin: 0 auto 10px;
  border-radius: 20px;
  background: #eef3e2;
}

.dialog-avatar {
  width: 46px;
  height: 52px;
}

.dialog h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.dialog .sub {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--muted);
}

.dialog input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 13px;
  background: #fffdf7;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease;
}

.dialog input:focus {
  border-color: var(--accent);
}

.dialog input::placeholder {
  color: #b9ab93;
}

.dialog .hint:empty {
  display: none;
}

.dialog .hint.error {
  color: var(--bad);
}

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 12px);
  padding: 10px 18px;
  border-radius: 13px;
  background: rgba(43, 31, 22, 0.92);
  color: #fff6e8;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 60;
  max-width: 80vw;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}



/* 弹窗里的主按钮 */

button.primary {
  width: 100%;
  margin-top: 12px;
  padding: 11px 14px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--accent-ink);
  transition: transform 0.08s ease, filter 0.15s ease;
}

button.primary:hover {
  filter: brightness(1.05);
}

button.primary:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--accent-ink);
}

button.primary:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* 登录 / 注册 切换 */
.tabs {
  display: flex;
  gap: 5px;
  margin: 0 0 14px;
  padding: 4px;
  border-radius: 13px;
  background: #f2ead9;
}

.tab {
  flex: 1;
  padding: 8px 6px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab.on {
  background: #fffaf0;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(75, 58, 44, 0.14);
}

.dialog input[hidden] {
  display: none;
}

.dialog .tabs + input {
  margin-top: 0;
}

.dialog input + input,
.dialog input + button {
  margin-top: 10px;
}

/* ---------------------------------------------------------------- 背包 */

.bag-dialog {
  width: min(430px, 92vw);
  position: relative;
}

.bag-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  min-height: 92px;
  max-height: 46vh;
  margin: 10px 0 14px;
  /* 只允许竖向滚动，并且把滚动条藏起来 —— 5 列宽度带小数时
     Chrome 会判定"溢出 0.x px"而横着冒出一条滚动条，很难看 */
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}

.bag-grid::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.bag-slot {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 4px 2px;
  border: 2px solid #e6dcc8;
  border-radius: 12px;
  background: #f8f3e7;
  font: inherit;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.bag-slot:hover {
  background: #fffaf0;
}

.bag-slot:active {
  transform: scale(0.96);
}

.bag-slot.picked {
  border-color: var(--accent);
  background: #eef3e2;
}

.bag-slot.seed {
  background: #f5f1e2;
}

.bag-glyph svg {
  width: 30px;
  height: 30px;
}

.bag-n {
  padding: 0 3px;
  border-radius: 7px;
  background: rgba(255, 250, 240, 0.92);
  border: 1px solid rgba(120, 96, 70, 0.18);
  font-size: 10px;
  font-weight: 900;
  color: #6a4b2c;
  line-height: 1.5;
  pointer-events: none;
  flex: 0 0 auto;
}

/* 名字 + 数量排在同一行，名字先让位，别被角标盖住 */
.bag-slot .lb {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  width: 100%;
  min-width: 0;
}

.bag-nm {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bag-tag {
  position: absolute;
  top: 3px;
  right: 4px;
  padding: 0 4px;
  border-radius: 6px;
  background: #e8f0e0;
  color: var(--accent-ink);
  font-size: 9px;
  font-weight: 800;
  line-height: 13px;
}

.bag-empty {
  grid-column: 1 / -1;
  margin: 12px 0;
  color: var(--muted);
  text-align: center;
  line-height: 1.8;
  font-size: 12.5px;
}

/* 点格子弹出来的操作 */
.bag-menu {
  position: absolute;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 124px;
  padding: 6px;
  border: 1px solid #e0d6c2;
  border-radius: 12px;
  background: #fffdf8;
  box-shadow: 0 10px 24px rgba(60, 48, 32, 0.2);
}

.bag-menu[hidden] {
  display: none;
}

.bag-act {
  padding: 8px 10px;
  border: none;
  border-radius: 9px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

/* 注意：类名都带 bag-act- 前缀，别用裸的 .use —— hud.css 里那个是画面右下角的大圆按钮 */
.bag-act-eat {
  background: #eef6e4;
  color: #3f7a33;
}

.bag-act-sell {
  background: #e8f0e0;
  color: var(--accent-ink);
}

.bag-act-use {
  background: #e7edf7;
  color: #3a63a8;
}

.bag-act:hover {
  filter: brightness(0.97);
}

.bag-dialog .primary {
  width: 100%;
}

.bag-dialog .primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.dialog .ghost {
  margin-top: 8px;
  width: 100%;
  padding: 9px;
  border: 1px solid #e0d6c2;
  border-radius: 11px;
  background: #fffaf0;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.dialog .ghost:hover {
  background: #fff;
}
/* 背包里的"吃"：和"卖出"并排，但更轻 */
.bag-eat {
  padding: 5px 10px;
  border: 1px solid #cfe0bd;
  border-radius: 9px;
  background: #f1f8e9;
  color: var(--accent-ink);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.bag-eat:hover {
  background: #e6f3d8;
}