/* 记忆对决 Mem Duel · 独立样式（选择器统一前缀 .g-memduel） */

.g-memduel {
  justify-content: flex-start;
  gap: 8px;
}

.g-memduel .btn:focus { outline: none; }
.g-memduel .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------- 顶部 ---------------- */

.g-memduel .md-head {
  align-items: center;
  gap: 8px;
  min-height: 38px;
}
.g-memduel .md-head .grow { min-width: 0; }
.g-memduel .md-head .seg { padding: 4px; }
.g-memduel .md-head .seg-item { min-height: 34px; font-size: 12px; }
.g-memduel .md-round { flex: none; font-size: 10.5px; color: var(--faint); white-space: nowrap; letter-spacing: 0.02em; }

/* ---------------- 竞技场 ---------------- */

.g-memduel .md-arenawrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.g-memduel .md-arena {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  gap: 8px;
  min-height: 0;
  min-width: 0;
}

.g-memduel .md-arena.layout-tb { flex-direction: column; }
.g-memduel .md-arena.layout-lr { flex-direction: row; }

.g-memduel .md-side {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid var(--line-2);
  overflow: hidden;
  transition: filter 0.18s ease, opacity 0.18s ease;
}

.g-memduel .md-side.p1 {
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(95, 160, 255, 0.22), transparent 62%),
    linear-gradient(160deg, rgba(55, 100, 190, 0.22), rgba(24, 40, 76, 0.22));
  border-color: rgba(121, 184, 255, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.g-memduel .md-side.p2 {
  background:
    radial-gradient(120% 120% at 100% 100%, rgba(255, 92, 108, 0.22), transparent 62%),
    linear-gradient(160deg, rgba(190, 60, 80, 0.22), rgba(76, 26, 36, 0.22));
  border-color: rgba(255, 92, 108, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.g-memduel .md-player {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  padding: 0 3px;
}

.g-memduel .md-pname {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--dim);
  white-space: nowrap;
}

.g-memduel .md-side.p1 .md-pname { color: #9cc8ff; }
.g-memduel .md-side.p2 .md-pname { color: #ffa3ac; }

.g-memduel .md-score {
  font-size: 19px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.g-memduel .md-side.p1 .md-score { color: #cfe4ff; }
.g-memduel .md-side.p2 .md-score { color: #ffd0d4; }

.g-memduel .md-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 8px;
}

.g-memduel .md-dots > i {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  transition: background 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}

.g-memduel .md-side.p1 .md-dots > i.on {
  background: #79b8ff;
  box-shadow: 0 0 7px rgba(121, 184, 255, 0.7);
  transform: scale(1.08);
}
.g-memduel .md-side.p2 .md-dots > i.on {
  background: #ff7b87;
  box-shadow: 0 0 7px rgba(255, 92, 108, 0.7);
  transform: scale(1.08);
}

/* ---------------- 选项面板 ---------------- */

.g-memduel .md-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  width: 100%;
}

.g-memduel .layout-lr .md-options { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }

.g-memduel .md-opt {
  display: flex;
  align-items: center;
  justify-content: center;
  height: clamp(48px, 7.2dvh, 62px);
  min-width: 0;
  padding: 0;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.055);
  color: var(--c, #fff);
  font-family: inherit;
  font-size: clamp(22px, 3.4dvh, 30px);
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.09s ease, background 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
  -webkit-tap-highlight-color: transparent;
}

.g-memduel .md-opt:active { transform: scale(0.95); }

.g-memduel .md-opt.hit {
  background: rgba(62, 207, 142, 0.24);
  border-color: rgba(126, 231, 135, 0.7);
  box-shadow: 0 0 16px rgba(62, 207, 142, 0.4);
}

.g-memduel .md-opt.miss {
  background: rgba(255, 92, 108, 0.24);
  border-color: rgba(255, 92, 108, 0.8);
  box-shadow: 0 0 16px rgba(255, 92, 108, 0.45);
}

.g-memduel .layout-lr .md-opt { height: clamp(44px, 6.6dvh, 56px); font-size: clamp(20px, 3dvh, 26px); border-radius: 11px; }

/* 锁定 */
.g-memduel .md-side.locked .md-options {
  opacity: 0.32;
  filter: grayscale(0.85);
  pointer-events: none;
}

.g-memduel .md-lock {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: rgba(8, 11, 18, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.16s ease, visibility 0.16s;
  pointer-events: none;
}
.g-memduel .md-lock.show { opacity: 1; visibility: visible; }
.g-memduel .md-lock-x { font-size: 30px; font-weight: 800; color: #ff7b87; line-height: 1; }
.g-memduel .md-lock-text { font-size: 11px; color: #ffc2c8; letter-spacing: 0.06em; }

/* ---------------- 中央序列区 ---------------- */

.g-memduel .md-center {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 10px 9px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(17, 24, 38, 0.97), rgba(9, 13, 21, 0.97));
  border: 1px solid rgba(183, 140, 255, 0.35);
  box-shadow: 0 20px 50px -22px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.14s ease, visibility 0.14s;
}

.g-memduel .md-center.show { opacity: 1; visibility: visible; }

.g-memduel .md-center-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.g-memduel .md-center-sub {
  font-size: 10.5px;
  color: var(--faint);
  line-height: 1.4;
  text-align: center;
}

.g-memduel .md-seq {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin: 1px 0;
}

.g-memduel .md-sym {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--c, #fff);
  font-size: 29px;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.g-memduel .md-show-bar { width: 100%; height: 3px; margin-top: 2px; }
.g-memduel .md-show-bar > i { width: 0%; background: linear-gradient(90deg, #ff5c6c, #b78cff); }

/* 中央状态色 */
.g-memduel .md-center.ready .md-center-title { color: var(--accent); }
.g-memduel .md-center.show .md-center-title { color: #e8ddff; }
.g-memduel .md-center.score .md-center-title { color: #ffd166; }
.g-memduel .md-center.draw .md-center-title { color: #ff9aa4; }

/* ---------------- 覆盖层 ---------------- */

.g-memduel .md-cover {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, #141b2c, #0a0e17);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s;
}

.g-memduel .md-cover.show { opacity: 1; visibility: visible; }

.g-memduel .md-cover-card {
  width: 100%;
  max-width: 300px;
  text-align: center;
}

.g-memduel .md-cover-title {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.3;
}

.g-memduel .md-cover-sub {
  margin-top: 7px;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--dim);
}

.g-memduel .md-cover-stats {
  display: flex;
  gap: 7px;
  margin: 14px 0 4px;
}

.g-memduel .md-cstat {
  flex: 1 1 0;
  min-width: 0;
  padding: 7px 3px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.g-memduel .md-cstat span {
  display: block;
  font-size: 9.5px;
  color: var(--faint);
  margin-bottom: 2px;
}

.g-memduel .md-cstat b {
  display: block;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.g-memduel .md-cover .btn { min-height: 45px; margin-top: 12px; }
.g-memduel .md-cover-extra {
  margin-top: 8px;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--faint);
}

/* ---------------- 操作行 / 底部 ---------------- */

.g-memduel .md-toolbar .btn { min-height: 42px; }

.g-memduel .md-meta { padding: 7px 12px 8px; }
.g-memduel .md-meta-head { align-items: baseline; gap: 8px; }
.g-memduel .md-meta-head .hint:first-child { color: var(--dim); font-weight: 600; }
.g-memduel .md-meta-head .hint:first-child.ok { color: var(--accent); }
.g-memduel .md-meta-head .hint:last-child { flex: none; color: var(--dim); font-variant-numeric: tabular-nums; }
.g-memduel .md-tip {
  margin-top: 4px;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--faint);
}

/* ---------------- 窄屏 / 动效偏好 ---------------- */

@media (max-width: 359px) {
  .g-memduel .md-head .seg-item { font-size: 11px; }
  .g-memduel .md-round { font-size: 10px; }
  .g-memduel .md-side { padding: 6px; gap: 6px; border-radius: 14px; }
  .g-memduel .md-opt { height: 46px; font-size: 22px; border-radius: 11px; }
  .g-memduel .layout-lr .md-opt { height: 42px; font-size: 19px; }
  .g-memduel .md-sym { width: 44px; height: 44px; font-size: 26px; }
  .g-memduel .md-seq { gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .g-memduel .md-side,
  .g-memduel .md-opt,
  .g-memduel .md-center,
  .g-memduel .md-cover { transition: none; }
  .g-memduel .md-dots > i { transition: none; }
}
