/* ys3d.css - YSM 3D viewer UI (ysm.9minecraft.net). Light/dark via [data-theme] or prefers-color-scheme. */
.ys3d, .yv {
  --ys-bg: #ffffff; --ys-fg: #1d2330; --ys-mut: #5f6878; --ys-card: #f5f7fb; --ys-line: #dfe3ec;
  --ys-acc: #2f7de1; --ys-acc-fg: #ffffff; --ys-chip: #ffffff; --ys-chip-on: #e3eefc;
  --ys-stage1: #f3f6fb; --ys-stage2: #dfe6f1; --ys-shadow: 0 1px 2px rgba(20, 30, 50, .08);
  color: var(--ys-fg);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ys3d, :root:not([data-theme="light"]) .yv {
    --ys-bg: #161a22; --ys-fg: #e7ebf2; --ys-mut: #9aa4b5; --ys-card: #1e232d; --ys-line: #2e3542;
    --ys-acc: #5aa0ff; --ys-acc-fg: #0d1420; --ys-chip: #232936; --ys-chip-on: #20375a;
    --ys-stage1: #262d3a; --ys-stage2: #151920; --ys-shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
[data-theme="dark"] .ys3d, [data-theme="dark"] .yv, .ys3d[data-theme="dark"] {
  --ys-bg: #161a22; --ys-fg: #e7ebf2; --ys-mut: #9aa4b5; --ys-card: #1e232d; --ys-line: #2e3542;
  --ys-acc: #5aa0ff; --ys-acc-fg: #0d1420; --ys-chip: #232936; --ys-chip-on: #20375a;
  --ys-stage1: #262d3a; --ys-stage2: #151920; --ys-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

/* ---------- viewer widget ---------- */
.ys3d { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); font: inherit; }
.ys3d * { box-sizing: border-box; }
@media (min-width: 900px) {
  .ys3d { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
}
.ys3d-stage {
  position: relative; width: 100%; height: min(72vh, 680px); min-height: 360px; border-radius: 14px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 38%, var(--ys-stage1) 0%, var(--ys-stage2) 100%);
  border: 1px solid var(--ys-line); user-select: none; -webkit-user-select: none;
}
@media (max-width: 600px) { .ys3d-stage { height: 64vh; min-height: 320px; border-radius: 12px; } }
.ys3d-canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; outline: none; }
.ys3d-canvas:active { cursor: grabbing; }
.ys3d-tools { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; z-index: 2; }
.ys3d-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; padding: 0; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--ys-line); background: var(--ys-bg); color: var(--ys-fg); box-shadow: var(--ys-shadow);
  -webkit-tap-highlight-color: transparent;
}
.ys3d-btn svg { width: 20px; height: 20px; fill: currentColor; }
.ys3d-btn:hover { border-color: var(--ys-acc); }
.ys3d-btn:focus-visible, .ys3d-chip:focus-visible, .ys3d-select:focus-visible { outline: 2px solid var(--ys-acc); outline-offset: 2px; }
.ys3d-btn[aria-pressed="true"] { background: var(--ys-acc); color: var(--ys-acc-fg); border-color: var(--ys-acc); }
.ys3d-now {
  position: absolute; left: 10px; bottom: 10px; max-width: calc(100% - 20px); z-index: 2; padding: 5px 10px; border-radius: 999px;
  background: var(--ys-bg); border: 1px solid var(--ys-line); font-size: 13px; color: var(--ys-mut); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; pointer-events: none;
}
.ys3d-loading, .ys3d-msg {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--ys-mut); font-size: 15px;
}
.ys3d-msg { color: var(--ys-fg); }
.ys3d-panel { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
@media (min-width: 900px) { .ys3d-panel { max-height: min(72vh, 680px); overflow: auto; padding-right: 2px; } }
.ys3d-texrow { display: flex; align-items: center; gap: 10px; }
.ys3d-lbl { font-size: 13px; font-weight: 600; color: var(--ys-mut); }
.ys3d-select {
  flex: 1; min-width: 0; min-height: 40px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--ys-line);
  background: var(--ys-chip); color: var(--ys-fg); font: inherit; font-size: 14px;
}
.ys3d-group { border: 1px solid var(--ys-line); border-radius: 12px; background: var(--ys-card); }
.ys3d-group > summary {
  cursor: pointer; list-style: none; padding: 10px 12px; font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px;
}
.ys3d-group > summary::-webkit-details-marker { display: none; }
.ys3d-group > summary::after { content: ''; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--ys-mut); border-bottom: 2px solid var(--ys-mut); transform: rotate(45deg); transition: transform .15s; }
.ys3d-group[open] > summary::after { transform: rotate(-135deg); }
.ys3d-count { font-weight: 600; font-size: 12px; color: var(--ys-mut); background: var(--ys-bg); border: 1px solid var(--ys-line); border-radius: 999px; padding: 1px 8px; }
.ys3d-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px 12px; max-height: 260px; overflow: auto; }
.ys3d-chip {
  display: inline-flex; flex-direction: column; align-items: flex-start; justify-content: center; min-height: 36px; max-width: 100%;
  padding: 5px 11px; border-radius: 10px; border: 1px solid var(--ys-line); background: var(--ys-chip); color: var(--ys-fg);
  font: inherit; font-size: 13px; line-height: 1.2; cursor: pointer; text-align: left; -webkit-tap-highlight-color: transparent;
}
.ys3d-chip:hover { border-color: var(--ys-acc); }
.ys3d-chip[aria-pressed="true"] { background: var(--ys-chip-on); border-color: var(--ys-acc); color: var(--ys-fg); box-shadow: inset 0 0 0 1px var(--ys-acc); }
.ys3d-chip-l { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.ys3d-chip-n { font-size: 11px; color: var(--ys-mut); }
.ys3d-note { color: var(--ys-mut); font-size: 14px; margin: 0; }
@media (pointer: coarse), (max-width: 600px) { .ys3d-chip { min-height: 40px; padding: 6px 12px; } .ys3d-btn { width: 44px; height: 44px; } }
/* fullscreen */
.ys3d:fullscreen, .ys3d.ys3d-fs { background: var(--ys-bg); padding: 12px; overflow: auto; }
.ys3d:fullscreen .ys3d-stage, .ys3d.ys3d-fs .ys3d-stage { height: calc(100vh - 24px); max-height: none; }
.ys3d.ys3d-fs { position: fixed; inset: 0; z-index: 9999; }
@media (min-width: 900px) { .ys3d:fullscreen .ys3d-panel, .ys3d.ys3d-fs .ys3d-panel { max-height: calc(100vh - 24px); } }
@media (max-width: 899px) { .ys3d:fullscreen .ys3d-stage, .ys3d.ys3d-fs .ys3d-stage { height: 70vh; } }

/* ---------- /viewer/ page ---------- */
.yv { display: block; }
.yv * { box-sizing: border-box; }
.yv-intro { margin: 0 0 16px; color: var(--ys-mut); line-height: 1.6; max-width: 760px; }
.yv-intro strong { color: var(--ys-fg); }
.yv-drop {
  display: grid; place-items: center; gap: 14px; text-align: center; padding: 36px 18px; border: 2px dashed var(--ys-line);
  border-radius: 16px; background: var(--ys-card); transition: border-color .15s, background .15s;
}
.yv-drop.is-over { border-color: var(--ys-acc); background: var(--ys-chip-on); }
.yv-drop-ic { width: 54px; height: 54px; fill: var(--ys-acc); }
.yv-drop h2 { margin: 0; font-size: 20px; }
.yv-drop p { margin: 0; color: var(--ys-mut); font-size: 14px; max-width: 520px; line-height: 1.5; }
.yv-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.yv-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--ys-acc); background: var(--ys-acc); color: var(--ys-acc-fg); font: inherit; font-weight: 700; font-size: 15px; cursor: pointer;
}
.yv-btn.alt { background: var(--ys-bg); color: var(--ys-fg); border-color: var(--ys-line); }
.yv-btn:focus-visible { outline: 2px solid var(--ys-acc); outline-offset: 2px; }
.yv-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.yv-status { min-height: 1.4em; margin: 12px 0 0; font-size: 14px; color: var(--ys-mut); text-align: center; }
.yv-status.err { color: #d04040; }
.yv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; margin: 0 0 12px; }
.yv-bar h2 { margin: 0; font-size: 20px; overflow-wrap: anywhere; }
.yv-info { margin-top: 16px; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .yv-info { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.yv-card { border: 1px solid var(--ys-line); border-radius: 14px; background: var(--ys-card); padding: 14px 16px; min-width: 0; }
.yv-card h3 { margin: 0 0 10px; font-size: 16px; }
.yv-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 14px; margin: 0; font-size: 14px; }
.yv-dl dt { color: var(--ys-mut); }
.yv-dl dd { margin: 0; overflow-wrap: anywhere; }
.yv-tips { white-space: pre-line; font-size: 14px; line-height: 1.55; margin: 0; overflow-wrap: anywhere; }
.yv-help { font-size: 13px; color: var(--ys-mut); margin: 10px 0 0; line-height: 1.5; }
.yv[hidden], .yv [hidden] { display: none !important; }
