/* Element Card Sort: the Element Archive desk inside the practice shell's stage. Cards are paper (fixed ink colors in
 * both themes); the room behind them darkens in dark mode. Text is 16px or larger. */
.ecs { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px 14px 10px; overflow: hidden; color: #2a1d10; font-size: 16px; }
.ecs > * { position: relative; z-index: 1; }
.ecs > .ecs-bg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; border-radius: var(--tlg-radius-lg, 14px); }
.ecs-bg-shade { opacity: 0; }
html[data-theme="dark"] .ecs-bg-shade { opacity: .38; }
.ecs :focus-visible { outline: 3px solid #ffcf5a; outline-offset: 3px; }

/* top strip */
.ecs-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 44px; }
.ecs-plaque { display: inline-flex; flex-direction: column; padding: 3px 14px 4px; border-radius: 8px; background: linear-gradient(#5e361c, #3e2210); border: 2px solid #c79a3e; box-shadow: 0 3px 6px rgba(0, 0, 0, .35); line-height: 1.15; }
.ecs-plaque-k { font-size: 16px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #e8c66a; }
.ecs-plaque-t { font-size: 20px; font-weight: 800; color: #fff8e6; font-family: Georgia, 'Times New Roman', serif; }
.ecs-model { padding: 4px 12px; border-radius: 999px; background: rgba(255, 248, 230, .92); border: 1.5px solid #a8865a; font-size: 16px; font-weight: 700; color: #3a2a10; }
.ecs-clue-btn { margin-left: auto; min-height: 44px; padding: 6px 16px; border-radius: 10px; font: inherit; font-size: 17px; font-weight: 800; cursor: pointer;
  color: #2a1d10; background: linear-gradient(#ffe9a8, #e8c66a); border: 2px solid #8a6420; box-shadow: 0 2px 0 #6b4a1a; touch-action: manipulation; }
.ecs-clue-btn:hover:not(:disabled) { background: linear-gradient(#fff2c8, #f0d482); }
.ecs-clue-btn[hidden] + .ecs-about { margin-left: auto; }
.ecs-about { position: relative; }
.ecs-about summary { min-height: 44px; display: flex; align-items: center; padding: 0 14px; border-radius: 10px; cursor: pointer; font-weight: 800; font-size: 16px; color: #fff8e6; background: rgba(30, 20, 10, .55); border: 1.5px solid rgba(255, 248, 230, .45); }
.ecs-about p { position: absolute; right: 0; top: 50px; width: min(520px, 80vw); margin: 0; padding: 12px 14px; z-index: 30; font-size: 16px; line-height: 1.45; color: #2a1d10;
  background: #fffaf0; border: 2px solid #a8865a; border-radius: 10px; box-shadow: 0 10px 24px rgba(0, 0, 0, .35); }

/* board */
.ecs-board { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }

/* a property card */
.ecs-card { position: relative; box-sizing: border-box; width: 200px; padding: 6px 10px 8px; border-radius: 8px; border-top: 6px solid #b5463a;
  background: linear-gradient(#fffaf0, #efe3c8); color: #2a1d10; box-shadow: 0 3px 0 #c9b38a, 0 6px 12px rgba(0, 0, 0, .3); text-align: left; }
.ecs-card-head { display: flex; align-items: baseline; gap: 8px; border-bottom: 1.5px solid #c9b38a; padding-bottom: 2px; margin-bottom: 3px; }
.ecs-sym { font-family: Georgia, 'Times New Roman', serif; font-size: 30px; font-weight: 800; line-height: 1.05; }
.ecs-name { font-size: 18px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ecs-props { margin: 0; display: grid; gap: 1px; }
.ecs-prop { display: flex; justify-content: space-between; align-items: center; gap: 6px; line-height: 1.3; }
.ecs-prop dt { color: #6b5332; font-size: 16px; }
.ecs-prop dd { margin: 0; font-size: 16px; font-weight: 700; text-align: right; }
.ecs-pat { font-weight: 600; color: #6b5332; }
.ecs-water { display: inline-flex; align-items: center; gap: 3px; }
.ecs-ico { width: 20px; height: 20px; color: #2f5a7a; flex: none; }
.ecs-mark { position: absolute; top: -12px; right: -10px; width: 32px; height: 32px; border-radius: 50%; display: none; place-items: center; font-size: 20px; font-weight: 900; color: #fff; }
.ecs-card.is-ok { box-shadow: 0 0 0 4px #2e8b57, 0 6px 12px rgba(0, 0, 0, .3); }
.ecs-card.is-bad { box-shadow: 0 0 0 4px #b42318, 0 6px 12px rgba(0, 0, 0, .3); outline: 3px dashed #fff; outline-offset: 2px; }
.ecs-card.is-ok .ecs-mark { display: grid; background: #2e8b57; }
.ecs-card.is-bad .ecs-mark { display: grid; background: #b42318; }
.ecs-fix { display: block; margin-top: 4px; padding: 2px 6px; border-radius: 6px; background: #b42318; color: #fff; font-size: 16px; font-weight: 800; }

/* drag tokens */
.ecs .pdz-token { cursor: grab; touch-action: none; }
.ecs .pdz-token.is-disabled { cursor: default; }
.ecs .pdz-token.is-picked { outline: 4px dashed #ffcf5a; outline-offset: 4px; transform: translateY(-4px); }
html .pdz-ghost.ecs-card { transform: rotate(-3deg); }
html.pdz-armed .ecs .pdz-zone { outline: 3px dashed rgba(255, 207, 90, .9); outline-offset: -3px; cursor: pointer; }
.ecs .pdz-zone.is-over { outline: 4px solid #ffcf5a !important; outline-offset: -4px; }

/* the desk tray */
.ecs-tray { box-sizing: border-box; width: min(100%, 760px); padding: 4px 12px 10px; border-radius: 14px; background: rgba(60, 34, 14, .32); border: 2px dashed rgba(255, 238, 200, .5); }
.ecs-tray-in { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; min-height: 176px; align-items: center; }
.ecs-zone-label { display: block; font-size: 16px; font-weight: 800; color: #fff8e6; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); text-align: center; padding: 2px 0 4px; }
.ecs-tray.is-empty .ecs-tray-in { min-height: 44px; }

/* family: catalog cabinet */
.ecs-cabinet { display: flex; gap: 12px; justify-content: center; width: 100%; }
.ecs-drawer { position: relative; box-sizing: border-box; width: 320px; min-height: 176px; padding: 8px 10px 26px; border-radius: 8px;
  background: linear-gradient(#8a5630, #6b3f22); border: 3px solid #3e2210; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .15), 0 6px 12px rgba(0, 0, 0, .35); transition: transform .4s ease; }
.ecs-drawer-label { margin: 0 auto 6px; width: fit-content; padding: 3px 12px; border-radius: 3px; background: #f3e6c6; border: 1.5px solid #6b4a1a; color: #2a1d10; text-shadow: none; font-size: 17px; }
.ecs-drawer-in { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; min-height: 100px; }
.ecs-drawer-pull { position: absolute; left: 50%; bottom: 8px; width: 56px; height: 9px; margin-left: -28px; border-radius: 6px; background: linear-gradient(90deg, #8a6420, #e8c66a, #9a7224); }
.ecs-drawer-pat { display: none; }
.ecs-drawer .ecs-card { width: 146px; padding: 4px 8px 6px; }
.ecs-drawer .ecs-card .ecs-prop { display: none; }
.ecs-drawer .ecs-card .ecs-prop--oxide { display: flex; }
.ecs-drawer .ecs-card .ecs-pat { display: none; }
.ecs-drawer .ecs-sym { font-size: 24px; }
.ecs-drawer .ecs-name { font-size: 16px; }
.ecs.is-reveal .ecs-drawer { transform: translateY(6px); }
.ecs.is-reveal .ecs-drawer-pat { display: block; margin-top: 6px; text-align: center; font-size: 17px; font-weight: 800; color: #2a1d10; background: #fbe3a2; border: 2px solid #b07a1a; border-radius: 6px; padding: 2px 6px; animation: ecs-stamp .5s ease both; }
.ecs--family.is-reveal .ecs-prop--oxide { background: #fbe3a2; border-radius: 4px; }
.ecs.is-reveal .ecs-tray.is-empty { visibility: hidden; }
.ecs-card.is-key { box-shadow: 0 0 0 4px #2e8b57, 0 6px 12px rgba(0, 0, 0, .3); }
.ecs-card.is-key .ecs-prop--oxide { background: #fbe3a2; border-radius: 4px; }

/* order / gap / prediction: the rack */
.ecs-rack { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ecs-rack-arrow { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; color: #fff8e6; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
.ecs-rack-arrow i { display: block; width: 360px; height: 4px; background: #fff8e6; position: relative; border-radius: 2px; box-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.ecs-rack-arrow i::after { content: ''; position: absolute; right: -4px; top: -6px; border: 8px solid transparent; border-left: 12px solid #fff8e6; border-right: 0; }
.ecs-rack-row { display: flex; gap: 16px; justify-content: center; }
.ecs-slot { position: relative; box-sizing: border-box; width: 218px; min-height: 212px; padding: 2px 8px 8px; border-radius: 12px; background: rgba(40, 22, 8, .42); border: 2px dashed rgba(255, 238, 200, .7); }
.ecs-slot.is-filled { border-style: solid; border-color: rgba(255, 238, 200, .35); }
.ecs-slot-in { display: flex; justify-content: center; min-height: 172px; align-items: flex-start; }
.ecs-gap-q { position: absolute; left: 0; right: 0; top: 60px; text-align: center; font: 800 64px/1 Georgia, serif; color: rgba(255, 248, 230, .55); pointer-events: none; }
.ecs-slot.is-filled .ecs-gap-q { display: none; }
.ecs-fix--gap { position: absolute; left: 8px; right: 8px; bottom: -14px; text-align: center; z-index: 2; }
.ecs-rack.show-pattern .ecs-prop--oxide { background: #fbe3a2; border-radius: 4px; animation: ecs-stamp .5s ease both; }
.ecs-rack.show-pattern .ecs-prop--mass { background: #dff0e6; border-radius: 4px; }

/* prediction: the blank eka-silicon card and its flip */
.ecs-flip { display: grid; perspective: 800px; }
.ecs-flip > .ecs-card { grid-area: 1 / 1; backface-visibility: hidden; transition: transform .4s ease, opacity .4s ease; }
.ecs-card--blank { border-top-color: #6b5332; background: repeating-linear-gradient(-45deg, #fffaf0 0 10px, #f6ecd6 10px 20px); }
.ecs-card--ge { transform: rotateY(90deg); opacity: 0; border-top-color: #2e8b57; }
.ecs-flip.is-flipped .ecs-card--blank { transform: rotateY(-90deg); opacity: 0; }
.ecs-flip.is-flipped .ecs-card--ge { transform: none; opacity: 1; transition-delay: .4s; }
.ecs-prop.is-ask { background: #fbe3a2; border-radius: 4px; padding: 0 3px; }
.ecs-ask { font: 800 22px/1 Georgia, serif; color: #8c2f2a; }
.ecs-guess { color: #1f4d7a; }
.ecs-dim { color: #8a7656; font-weight: 600; }
.ecs-blank-k { margin: 4px 0 0; font-size: 16px; font-style: italic; color: #6b5332; text-align: center; }

/* swap: two family columns */
.ecs-chart { display: flex; gap: 28px; justify-content: center; }
.ecs-col { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 12px 10px; border-radius: 12px; background: rgba(40, 22, 8, .42); border: 2px solid rgba(255, 238, 200, .35); }
.ecs-col-k { margin: 0; font-size: 17px; font-weight: 800; color: #fff8e6; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
.ecs-minis { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.ecs-mini { display: grid; place-items: center; width: 52px; height: 32px; border-radius: 6px; background: #efe3c8; border: 1.5px solid #a8865a; font: 800 18px/1 Georgia, serif; color: #2a1d10; }
.ecs-card--tei { width: 220px; }

/* word-bank tiles */
.ecs-tiles { box-sizing: border-box; width: min(100%, 900px); padding: 4px 12px 10px; border-radius: 14px; background: rgba(60, 34, 14, .45); border: 2px solid rgba(255, 238, 200, .35); }
.ecs-tiles-k { margin: 0 0 6px; font-size: 17px; font-weight: 800; color: #fff8e6; text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
.ecs-tiles-row { display: flex; gap: 10px; justify-content: center; }
.ecs-tile { flex: 1 1 0; max-width: 300px; min-height: 56px; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; font: inherit; font-size: 17px; font-weight: 700; text-align: left; line-height: 1.3; cursor: pointer;
  color: #2a1d10; background: linear-gradient(#fffaf0, #efe3c8); border: 2px solid #a8865a; box-shadow: 0 3px 0 #8a6a3a; touch-action: manipulation; }
.ecs-tile:hover:not(:disabled) { border-color: #7a2e26; }
.ecs-tile:disabled { cursor: default; }
.ecs-tile-dot { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid #6b5332; background: #fff; }
.ecs-tile.is-on { border-color: #7a2e26; border-width: 3px; box-shadow: 0 3px 0 #4a1a14; }
.ecs-tile.is-on .ecs-tile-dot { background: radial-gradient(#7a2e26 45%, #fff 50%); border-color: #7a2e26; }
.ecs-tile.is-key { border-color: #2e8b57; border-width: 3px; background: linear-gradient(#f2fbf5, #d6efdf); }
.ecs-tile.is-key .ecs-tile-t::before { content: '✓ '; color: #1d6b40; font-weight: 900; }
.ecs-tile.is-wrong { border-color: #b42318; border-style: dashed; }
.ecs-tile.is-wrong .ecs-tile-t::before { content: '✗ '; color: #b42318; font-weight: 900; }

/* reveal panels */
.ecs-chartbox { box-sizing: border-box; width: min(100%, 760px); margin-top: 8px; padding: 6px 14px 8px; border-radius: 12px; background: #fffaf0; border: 2px solid #a8865a; box-shadow: 0 6px 14px rgba(0, 0, 0, .3); animation: ecs-rise .45s ease both; }
.ecs-chartbox--bars { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 0; }
.ecs-bars-k { margin: 0 0 4px; font-size: 16px; font-weight: 800; }
.ecs-bar { display: grid; grid-template-columns: 34px 1fr 108px; align-items: center; gap: 6px; font-size: 16px; }
.ecs-bar-l { font: 800 18px/1 Georgia, serif; }
.ecs-bar-t { height: 16px; border-radius: 8px; background: #efe3c8; overflow: hidden; }
.ecs-bar-t i { display: block; height: 100%; width: var(--w); border-radius: 8px; animation: ecs-grow .7s ease both; animation-delay: var(--d); }
.ecs-bars--mass .ecs-bar-t i { background: linear-gradient(90deg, #2e8b57, #46b37a); }
.ecs-bars--density .ecs-bar-t i { background: repeating-linear-gradient(90deg, #6b5332 0 6px, #8a7656 6px 10px); }
.ecs-bar-v { font-weight: 700; text-align: right; }
.ecs-compare { width: 100%; border-collapse: collapse; font-size: 16px; }
.ecs-compare th, .ecs-compare td { padding: 2px 8px; text-align: left; border-bottom: 1px solid #e0cfa8; }
.ecs-compare thead th { font-weight: 800; }
.ecs-compare .is-ask { background: #fbe3a2; }
.ecs-compare tbody th { white-space: nowrap; }
.ecs-order { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 3px 0; font-size: 16px; animation: ecs-rise .45s ease both; }
.ecs-order--z { animation-delay: .5s; }
.ecs-order-k { width: 150px; font-weight: 800; }
.ecs-chip { padding: 2px 10px; border-radius: 6px; background: #efe3c8; border: 1.5px solid #a8865a; font-weight: 800; }
.ecs-order-v { font-weight: 700; }
.ecs-order--mass .ecs-order-v { color: #b42318; }
.ecs-order--z .ecs-order-v { color: #1d6b40; }

/* clue note + status */
.ecs-note { position: absolute; left: 16px; bottom: 16px; z-index: 20; max-width: 440px; padding: 10px 14px; font-size: 17px; line-height: 1.4; color: #2a1d10; background: #fff3b0; border-radius: 4px; box-shadow: 0 8px 18px rgba(0, 0, 0, .35); transform: rotate(-.6deg); }
.ecs-note[hidden], .ecs-status[hidden] { display: none; }
.ecs-status { margin: 0; align-self: center; max-width: 960px; padding: 6px 16px; border-radius: 10px; font-size: 17px; font-weight: 800; line-height: 1.35; background: #fffaf0; border: 2px solid #a8865a; animation: ecs-rise .4s ease both; }
.ecs-status.is-ok { border-color: #2e8b57; color: #14532d; }
.ecs-status.is-bad { border-color: #b42318; color: #7f1d1d; }

@keyframes ecs-stamp { from { transform: scale(1.25); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ecs-rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ecs-grow { from { width: 0; } to { width: var(--w); } }
.ecs.is-still *, .ecs.is-still *::before, .ecs.is-still *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .ecs *, .ecs *::before, .ecs *::after { animation: none !important; transition: none !important; }
}

/* narrow screens: the stage may scroll */
@media (max-width: 900px) {
  .ecs { position: relative; min-height: 100%; overflow: visible; }
  .ecs-cabinet, .ecs-rack-row, .ecs-chart, .ecs-tiles-row { flex-wrap: wrap; }
  .ecs-drawer { width: min(320px, 100%); }
  .ecs-rack-arrow i { width: 160px; }
  .ecs-chartbox--bars { grid-template-columns: 1fr; }
  .ecs-tile { max-width: none; flex-basis: 100%; }
}
@media (max-width: 520px) {
  .ecs-card { width: 160px; }
  .ecs-slot { width: 176px; }
  .ecs-tray-in { gap: 8px; }
}
