/* Trophy Room: the owner plate over the room, and the arrange-your-room editor under it. Arcade style in CSS (gold on
   purple, pixel shadows), so the editor costs no extra images on phones. */
.trophy-page { --tr-gold: #f5c56b; --tr-ink: #ffe2ac; --tr-panel: #17142bf0; --tr-deep: #0d0b1c; --tr-line: #c99a3e; }

.tr-bar { position: absolute; left: 16px; right: 16px; top: 14px; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px;
  align-items: flex-start; justify-content: space-between; pointer-events: none; }
.tr-bar > * { pointer-events: auto; }
.tr-plate { display: grid; gap: 2px; padding: 10px 16px 11px; border: 3px solid var(--tr-gold); background: var(--tr-panel);
  box-shadow: 5px 5px 0 #000a, inset 0 0 0 2px #5a2d0e; color: var(--tr-ink); }
.tr-kicker { font: 900 10px/1 monospace; letter-spacing: .18em; color: #c9a0ff; }
.tr-plate strong { font: 900 22px/1.1 "Cinzel", serif; color: #ffd98a; text-shadow: 0 2px 0 #5a2d0e, 0 0 12px #ffb54a66; }
.tr-note { font: 700 11px/1.3 monospace; color: #e8cfa0; }
.tr-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.tr-signin { display: flex; gap: 6px; flex-wrap: wrap; }

.tr-btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 8px 14px;
  border: 2px solid var(--tr-line); background: linear-gradient(#3a2560, #24173f); color: var(--tr-ink);
  font: 900 12px/1 monospace; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; cursor: pointer;
  box-shadow: 3px 3px 0 #000b; }
.tr-btn:hover:not(:disabled), .tr-btn:focus-visible { border-color: #ffe08a; color: #fff; filter: brightness(1.15); outline: none; }
.tr-btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000b; }
.tr-btn:disabled { opacity: .45; cursor: default; }
.tr-primary { background: linear-gradient(#f7c65a, #c98a23); color: #2a1405; border-color: #fff0b8; }
.tr-primary:hover:not(:disabled) { color: #1a0b02; }
.tr-danger { background: linear-gradient(#7a2333, #4d1220); border-color: #ff8a8a; }
.tr-input { min-height: 38px; padding: 6px 10px; border: 2px solid var(--tr-line); background: var(--tr-deep); color: var(--tr-ink);
  font: 700 13px monospace; }

/* the editor lives inside the room: a toolbar in the bar, a drawer on the right (a bottom sheet on phones), and a small
   menu beside the selected piece. Only these panels take pointer events, so dragging and swiping the room still work. */
.tr-toolbar .tr-btn.tr-on { border-color: #ffe08a; background: linear-gradient(#5a3a8f, #3a2560); color: #fff; }
.tr-status { font: 700 12px monospace; color: #9df59d; padding: 4px 8px; background: var(--tr-panel); border: 2px solid #9df59d55; }
.tr-drawer { position: absolute; right: 16px; top: 96px; bottom: 76px; z-index: 7; width: min(380px, calc(100% - 32px)); display: flex; flex-direction: column;
  border: 3px solid var(--tr-gold); background: var(--tr-panel); box-shadow: 6px 6px 0 #000a; color: var(--tr-ink); backdrop-filter: blur(3px); }
.tr-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 8px 14px; border-bottom: 2px solid #5b4386; }
.tr-drawer-head strong { font: 900 13px monospace; letter-spacing: .14em; text-transform: uppercase; color: #ffd98a; }
.tr-x { appearance: none; width: 34px; height: 34px; border: 2px solid #5b4386; background: #1f1838; color: var(--tr-ink); font: 900 14px monospace; cursor: pointer; }
.tr-x:hover, .tr-x:focus-visible { border-color: var(--tr-gold); outline: none; }
.tr-drawer-body { flex: 1; overflow: auto; padding: 10px 12px 14px; overscroll-behavior: contain; }
.tr-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.tr-chip { appearance: none; padding: 6px 9px; border: 2px solid #5b4386; background: #1f1838; color: #d8c4ff; font: 900 10px monospace;
  letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
.tr-chip.on { border-color: var(--tr-gold); background: #3a2560; color: #ffe08a; }
.tr-hint { color: #a9b6d8; font: 400 12px monospace; }
.tr-help { margin: 10px 0 8px; font: 13px/1.4 system-ui, sans-serif; color: #cdbfe6; }
.tr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.tr-piece { position: relative; appearance: none; display: grid; grid-template-rows: 76px auto; gap: 4px; padding: 6px; border: 2px solid #4b3a78; background: #120f24;
  color: var(--tr-ink); font: 700 11px/1.2 system-ui, sans-serif; cursor: pointer; text-align: center; }
.tr-piece img { width: 100%; height: 76px; object-fit: contain; }
.tr-piece:hover, .tr-piece:focus-visible { border-color: var(--tr-gold); background: #221a40; outline: none; }
.tr-piece.tr-locked { cursor: help; }
.tr-piece.tr-locked img { filter: grayscale(1) brightness(.45); }
.tr-lock { position: absolute; top: 4px; right: 4px; padding: 2px 5px; background: #000c; border: 1px solid var(--tr-gold); color: #ffd98a;
  font: 900 9px monospace; font-style: normal; letter-spacing: .08em; }
.tr-lock.tr-own { border-color: #9df59d; color: #9df59d; }
.tr-walls { display: grid; gap: 8px; }
.tr-wallrow { display: flex; gap: 6px; align-items: center; }
.tr-wallrow strong { min-width: 18px; font: 900 12px monospace; }
.tr-wallrow select { flex: 1; min-width: 0; width: auto; }
.tr-walls > * { min-width: 0; }
.tr-walls .tr-soon { white-space: normal; }
.tr-wallrow .tr-btn { padding: 6px 9px; }
.tr-settings { display: grid; gap: 8px; }
.tr-radio { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 2px solid #4b3a78; background: #120f24; cursor: pointer; }
.tr-radio.on { border-color: var(--tr-gold); background: #221a40; }
.tr-radio input { margin-top: 3px; accent-color: #f5c56b; }
.tr-radio span { display: grid; gap: 3px; }
.tr-radio b { font: 900 13px monospace; color: #ffe08a; }
.tr-radio small { font: 12px/1.35 system-ui, sans-serif; color: #cdbfe6; overflow-wrap: anywhere; }
.tr-pop { position: absolute; left: 0; top: 0; z-index: 8; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; max-width: min(460px, calc(100% - 16px));
  padding: 8px 10px; border: 2px solid #7cf0ff; background: var(--tr-panel); box-shadow: 4px 4px 0 #000a; color: var(--tr-ink); font: 700 12px monospace; }
.tr-pop strong { color: #ffe08a; }
.tr-pop .tr-btn { min-height: 32px; padding: 4px 10px; }
.tr-pop .tr-input { min-height: 32px; width: 180px; }
.tr-pop-acts { display: inline-flex; gap: 6px; margin-left: auto; }
.tr-pop.tr-gone { visibility: hidden; }

/* pieces in the room while arranging */
.tr-editing .lab-world .item { cursor: grab; touch-action: none; }
.tr-editing .lab-world .item:hover .sprite { filter: drop-shadow(0 0 10px #7cf0ffaa); }
.lab-world .item.tr-sel .sprite { filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 16px #7cf0ff); }

@media (max-width: 700px) {
  .tr-bar { left: 8px; right: 8px; top: 8px; }
  .tr-plate { padding: 7px 10px; }
  .tr-plate strong { font-size: 16px; }
  .tr-btn { min-height: 34px; padding: 6px 10px; font-size: 11px; }
  .tr-toolbar { justify-content: flex-start; gap: 4px; }
  .tr-toolbar .tr-btn { padding: 6px 7px; letter-spacing: .02em; }
  .tr-drawer { left: 0; right: 0; bottom: 0; top: auto !important; width: auto; height: 52%; border-width: 3px 0 0; box-shadow: 0 -4px 0 #000a; }
  .tr-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
  .tr-piece { grid-template-rows: 56px auto; font-size: 10px; }
  .tr-piece img { height: 56px; }
  .tr-pop { font-size: 11px; }
  .tr-pop .tr-input { width: 140px; }
}

/* code-drawn details: splinter colour over cream cloth / grey ribbon (multiply keeps the art's shading), engraved text */
.lab-world .item .tr-tint { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply; opacity: .92;
  mask-size: 100% 100%; mask-repeat: no-repeat; -webkit-mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; }
.tr-engrave { position: absolute; display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap;
  font-family: "Cinzel", serif; font-weight: 900; line-height: 1; color: #3b1d05; text-shadow: 0 2px 0 #fff0b8aa, 0 0 8px #ffe08a55;
  letter-spacing: .02em; pointer-events: none; }
.tr-walltext { z-index: 3; }

.tr-swatches { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.tr-swatch { width: 28px; height: 28px; padding: 0; border: 2px solid #0008; box-shadow: 2px 2px 0 #000a; cursor: pointer; }
.tr-swatch.on { outline: 3px solid #fff; outline-offset: 1px; }
.tr-swatch-none { background: repeating-linear-gradient(45deg, #f4ead2 0 6px, #cbbf9f 6px 12px); }
.tr-swatch-dye { border-radius: 50%; border-color: #ffe08a; }   /* dyes the player holds (arcade-dyes.js paints), after the splinter colours */

.tr-music { position: absolute; left: 50%; bottom: 70px; z-index: 6; transform: translateX(-50%); display: flex; gap: 8px; align-items: center;
  max-width: calc(100% - 32px); padding: 8px 10px; border: 3px solid var(--tr-gold); background: var(--tr-panel); box-shadow: 5px 5px 0 #000a; color: var(--tr-ink); }
.tr-music strong { font: 900 13px monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-music-src { font: 700 10px monospace; color: #c9a0ff; text-transform: uppercase; }
.tr-music .tr-btn { min-height: 32px; padding: 4px 10px; }
.tr-next { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.tr-next li { display: grid; gap: 2px; padding: 8px 10px; border: 2px solid #4b3a78; background: #120f24; }
.tr-next b { font: 900 12px monospace; color: #ffe08a; }
.tr-next small { font: 12px/1.35 system-ui, sans-serif; color: #cdbfe6; }
.tr-title { font: 900 11px/1.2 "Cinzel", serif; letter-spacing: .08em; color: #f5c56b; text-transform: uppercase; }
.tr-lab { display: grid; gap: 6px; margin-top: 10px; padding: 10px; border: 2px dashed #ff8a8a; background: #2a0f1a; }
.tr-lab b { font: 900 11px monospace; letter-spacing: .14em; color: #ff9a9a; }
.tr-lab small { font: 12px/1.35 system-ui, sans-serif; color: #e8cfd8; }
.tr-lab-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.lab-world .item.tr-bkaw .sprite { animation: tr-shake .12s linear 4; }
.tr-bkaw-say { position: absolute; left: 50%; top: -34px; transform: translateX(-50%) rotate(-6deg); padding: 3px 8px; border: 2px solid #2a1405;
  background: #fff6c8; color: #c1121f; font: 900 20px/1 "Press Start 2P", monospace; white-space: nowrap; box-shadow: 3px 3px 0 #000a; pointer-events: none; }
@keyframes tr-shake { 0%, 100% { transform: translateX(0) } 25% { transform: translateX(-3px) rotate(-2deg) } 75% { transform: translateX(3px) rotate(2deg) } }

/* The Splinterlands binder table (owner 11-15): the room owner's binder, opened on splinterlands.com. --cover = their
   in-game cover colour. .tr-binder-drawn = the stand-in drawn in code until the binder table art lands. */
.tr-binder { position: absolute; display: block; pointer-events: none; --cover: #3d2a63; }
.tr-binder-drawn { display: flex; gap: 3%; padding: 3.5% 4%; background: linear-gradient(160deg, color-mix(in srgb, var(--cover) 82%, #fff), var(--cover) 45%, color-mix(in srgb, var(--cover) 70%, #000));
  border-radius: 6px; box-shadow: inset 0 0 0 3px #e9b94966, 0 6px 0 #1a0d24aa; box-sizing: border-box; }
.tr-binder-page { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 5%; padding: 5%;
  background: linear-gradient(180deg, #f4ecd9, #ddd0b3); border-radius: 3px; box-shadow: inset 0 0 6px #0004; }
.tr-sleeve { background: linear-gradient(135deg, #2a2440 0 40%, #3a3358 55%, #2a2440 70%); border-radius: 2px; box-shadow: inset 0 0 0 1px #ffffff55; }
.tr-binder-rings { position: absolute; left: 50%; top: 14%; bottom: 14%; width: 3.2%; transform: translateX(-50%);
  background: repeating-linear-gradient(180deg, transparent 0 18%, #e9b949 18% 26%, transparent 26% 40%); }
.rings-chrome .tr-binder-rings { background: repeating-linear-gradient(180deg, transparent 0 18%, #d8dde6 18% 26%, transparent 26% 40%); }
.rings-black .tr-binder-rings { background: repeating-linear-gradient(180deg, transparent 0 18%, #15121c 18% 26%, transparent 26% 40%); }
.tr-binder-stand { position: absolute; left: 30%; right: 30%; bottom: -9%; height: 9%; background: linear-gradient(#e9b949, #9b6a1f); border-radius: 0 0 4px 4px; }
.tr-binder-name { position: absolute; left: 4%; right: 4%; top: 100%; margin-top: 7%; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font: 900 24px/1.3 "Cinzel", Georgia, serif; letter-spacing: .06em; color: #ffe2ac; text-shadow: 1px 1px 0 #2a1406, 0 0 6px #000; text-transform: uppercase; }
.tr-binder-plate .tr-binder-name { inset: 0; margin: 0; display: flex; align-items: center; justify-content: center; font: 900 1em/1 "Cinzel", Georgia, serif;
  letter-spacing: .02em; color: #3b1d05; text-shadow: 0 2px 0 #fff0b8aa, 0 0 8px #ffe08a55; }
.tr-card{position:absolute;z-index:-1;object-fit:cover;object-position:50% 22%;background:#1a1030;pointer-events:none}.lab-world .item:has(.tr-card){isolation:isolate}
.tr-card.card-cutout{object-fit:contain;object-position:50% 100%;background:radial-gradient(circle at 50% 40%,#4b3a78,#1a1030 75%)}

/* Counted pieces (owner 11-16): how many of an inventory piece are placed / held. */
.tr-count { position: absolute; top: 4px; left: 4px; padding: 2px 5px; background: #000c; border: 1px solid #9df59d; color: #9df59d;
  font: 900 9px monospace; font-style: normal; letter-spacing: .06em; }
.tr-count.tr-count-full { border-color: #ff9a9a; color: #ff9a9a; }
.tr-piece.tr-full img { opacity: .45; }

/* Lamps glow (click one to switch it off): a warm halo, screen-blended over the shade and the wall behind it. */
.lab-world .item .tr-glow { position: absolute; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, #fff4c8f0 0%, #ffd27aa8 16%, #ffa83a48 40%, #ff8a2000 68%); mix-blend-mode: screen;
  animation: tr-glow 5s ease-in-out infinite; }
.lab-world .item .tr-glow[data-c="lava"] { background: radial-gradient(circle, #ffe0b0f0 0%, #ff8a3aa8 16%, #ff4fa048 40%, #ff4fa000 68%); }
.lab-world .item .tr-glow[data-c="pink"] { background: radial-gradient(circle, #ffd0f4c0 0%, #ff4fd890 18%, #ff2fc040 42%, #ff2fc000 68%); }
.lab-world .item.tr-off .tr-glow { opacity: 0; animation: none; transition: opacity .15s; }
.lab-world .item.tr-off .sprite { filter: brightness(.72) saturate(.8); }
@keyframes tr-glow { 0%, 100% { opacity: .9 } 45% { opacity: 1 } 52% { opacity: .82 } 58% { opacity: .97 } }

/* Squeaky toys squash; plushies hop and puff hearts. */
.lab-world .item.tr-squish .sprite { transform-origin: 50% 100%; animation: tr-squish .3s ease-out; }
@keyframes tr-squish { 0% { transform: scale(1) } 30% { transform: scale(1.18, .72) } 65% { transform: scale(.94, 1.08) } 100% { transform: scale(1) } }
.lab-world .item.tr-hop .sprite { transform-origin: 50% 100%; animation: tr-hop .5s cubic-bezier(.3, .7, .4, 1); }
@keyframes tr-hop { 0% { transform: none } 18% { transform: scale(1.1, .86) } 45% { transform: translateY(-22%) scale(.95, 1.06) } 75% { transform: none } 85% { transform: scale(1.05, .95) } 100% { transform: none } }
.lab-world .item:not([data-tip])::after { display: none; }   /* no empty hover label on pieces without a tip */
.tr-say { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) rotate(-5deg); padding: 5px 10px; border: 3px solid #2a1405;
  background: #fff6c8; font: 900 22px/1 "Press Start 2P", monospace; white-space: nowrap; box-shadow: 2px 2px 0 #000a; pointer-events: none; z-index: 2; }
.tr-say-squeak { color: #1d6fd6; }
.tr-say-hop { color: #c1121f; }
.tr-heart { position: absolute; left: 50%; top: 20%; width: 22px; height: 20px; pointer-events: none; font-size: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 10' shape-rendering='crispEdges'%3E%3Cpath fill='%236b0f2a' d='M1 0h3v1h1v1h1V1h1V0h3v1h1v4h-1v1h-1v1h-1v1h-1v1h-1v1H5V9H4V8H3V7H2V6H1V5H0V1h1z'/%3E%3Cpath fill='%23ff5d8f' d='M1 1h3v1h1v1h1V2h1V1h3v4H9v1H8v1H7v1H6v1H5V8H4V7H3V6H2V5H1z'/%3E%3Cpath fill='%23ffc2d6' d='M2 2h1v1H2z'/%3E%3C/svg%3E") center/contain no-repeat;
  animation: tr-heart .85s ease-out forwards; }
@keyframes tr-heart { from { transform: translate(-50%, 0) scale(.6); opacity: 1 } to { transform: translate(calc(-50% + var(--dx)), -90px) scale(1.15); opacity: 0 } }
@media (prefers-reduced-motion: reduce) { .lab-world .item .tr-glow { animation: none; } .lab-world .item.tr-hop .sprite, .lab-world .item.tr-squish .sprite, .tr-heart { animation: none; } }
.lab-world .item.tr-hop::after, .lab-world .item.tr-squish::after, .lab-world .item.tr-bkaw::after { opacity: 0; }
