/* 03 동식물을 키우자! — 야간 관찰 카메라로 들여다보는 사육실. 색은 style.css 변수만 쓴다 */
.g3 {
  position: absolute; inset: 0; padding: 12px 18px 16px;
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(340px, 25vw, 460px); grid-template-rows: auto minmax(0, 1fr); gap: 12px;
}

/* 먹이사슬 줄 */
.g3-chain { grid-column: 1 / -1; display: flex; align-items: center; gap: 22px; padding: 8px 20px; }
.g3-chain-l { display: flex; flex-direction: column; gap: 1px; padding-right: 22px; border-right: 1px solid var(--line2); }
.g3-chain-l b { font-size: 22px; font-weight: 900; letter-spacing: -.03em; }
.g3-chain-l .g3-small { font-size: 14px; color: var(--k2); font-weight: 600; }
.g3-nodes { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.g3-node { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 6px; border: 1px solid transparent; transition: opacity .3s, border-color .3s; }
.g3-nimg { width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; }
.g3-nt { display: flex; flex-direction: column; line-height: 1.15; }
.g3-nt b { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.g3-nt span { font-size: 13px; color: var(--k2); font-weight: 600; }
.g3-nt em { font-style: normal; font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--k3); margin-top: 2px; }
.g3-node.wait { opacity: .62; }
.g3-node.wait em { color: var(--k2); }
.g3-node.now { border-color: var(--leaf); }
.g3-node.now em { color: var(--leaf); }
.g3-node.done em { color: var(--k2); }
.g3-arr { flex: 1; max-width: 120px; min-width: 40px; }
.g3-arr svg { width: 100%; height: 16px; display: block; overflow: visible; }
.g3-arr path { fill: none; stroke: var(--k3); stroke-width: 1.6; stroke-dasharray: 4 5; }
.g3-arr.on path { stroke: var(--k2); stroke-dasharray: none; }
.g3-arr.live path { stroke: var(--leaf); stroke-width: 2.2; stroke-dasharray: 6 5; animation: flow 1s linear infinite; }

/* 카메라 화면(방) — 16:9로 고정해 칸 안에 맞춘다 */
.g3-cam { min-height: 0; min-width: 0; container-type: size; display: grid; place-items: center; }
.g3-room {
  position: relative; overflow: hidden; border: 1px solid var(--line2);
  width: min(100cqw, 100cqh * 16 / 9); height: min(100cqh, 100cqw * 9 / 16);
}
.g3-room > .vf { position: absolute; inset: 10px; z-index: 6; pointer-events: none; --vf: var(--k2); }
.g3-rec { position: absolute; left: 22px; top: 16px; z-index: 6; }
.g3-wall { position: absolute; left: 0; right: 0; top: 0; height: 58%; background: var(--paper2); }
.g3-floor { position: absolute; left: 0; right: 0; bottom: 0; top: 58%; background: var(--paper3); border-top: 1px solid var(--line2); }
.g3-room img.spr { position: absolute; }

.g3-win { position: absolute; }
.g3-win img.spr { position: relative; height: 100%; width: auto; max-width: none; }
.g3-sky { position: absolute; inset: 13% 9% 12%; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 16%, var(--paper)), color-mix(in srgb, var(--c) 6%, var(--paper))); }
.g3-win.w1 { left: 5%; top: 6%; height: 27%; }
.g3-win.w2 { left: 41%; top: 7%; height: 22%; }
.g3-win.w3 { left: 62%; top: 5%; height: 27%; }
.g3-toy { right: 2%; top: 40%; height: 15%; }
.g3-home.g3-toy { opacity: .85; }

/* 제자리: 다 자란 생물이 들어가면 밝아진다 */
.g3-home { position: absolute; transition: opacity .5s; opacity: .6; }
.g3-home > img.spr { position: relative; height: 100%; width: auto; max-width: none; }
.g3-home.on { opacity: 1; }
.g3-home.h-wbed { left: 2.5%; bottom: 11%; height: 32%; }
.g3-home.h-rhouse { left: 11%; bottom: 3%; height: 44%; }
.g3-home.h-perch { left: 73%; top: 33%; height: 25%; }
.g3-home.h-pot { right: 3%; bottom: 3%; height: 40%; }
.g3-hl {
  position: absolute; left: 50%; bottom: -2px; transform: translate(-50%, 100%); white-space: nowrap; z-index: 3;
  font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: .04em; color: var(--k); padding: 1px 6px; background: var(--paper);
}
.g3-home.h-pot .g3-hl, .g3-toy .g3-hl { bottom: auto; top: -4px; transform: translate(-50%, -100%); }
.g3-home.h-rhouse .g3-hl { display: none; }   /* 학생이 집에 「토끼집」을 써 두어 이름표를 겹쳐 달지 않는다 */
.g3-home.h-perch .g3-hl { left: -4px; top: 46%; bottom: auto; transform: translate(-100%, -50%); }
.g3-home.on .g3-hl { color: var(--paper); background: var(--leaf); }
.g3-res { position: absolute; inset: 0; pointer-events: none; }
.g3-res img.spr { position: absolute; animation: g3in .6s ease-out both; }
.h-rhouse .g3-res img.spr { right: -2%; bottom: 0; height: 42%; width: auto; max-width: none; }
.h-wbed .g3-res img.spr { left: 50%; top: 30%; height: 58%; width: auto; max-width: none; transform: translateX(-50%); animation: none; }
.h-perch .g3-res img.spr { left: 8%; top: -42%; height: 62%; width: auto; max-width: none; }
@keyframes g3in { from { opacity: 0; } }

/* 지금 키우는 생물 */
.g3-star { position: absolute; left: 37%; width: 33%; bottom: 5%; height: 64%; z-index: 4; }
.g3-who { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; }
.g3-det { height: calc(var(--s, 1) * 86%); display: flex; align-items: flex-end; justify-content: center; transition: height .45s cubic-bezier(.3, 1.4, .5, 1); }
.g3-det > img.spr, .g3-det > svg { position: relative; height: 100%; width: auto; max-width: none; }
.g3-det.seed { height: auto; margin-bottom: 4%; }
.g3-det > svg.g3-seed { width: 230px; height: 115px; }
.g3-seed .soil { fill: none; stroke: var(--k2); stroke-width: 2; }
.g3-seed .seed { fill: var(--y); stroke: var(--k); stroke-width: 1.5; }
.g3-empty { margin-bottom: 18%; padding: 30px 26px; border: 1px dashed var(--line2); font-family: var(--mono); font-size: 14px; letter-spacing: .1em; color: var(--k3); }
.g3-star.eat .g3-det { animation: g3eat .45s ease-out; }
@keyframes g3eat { 30% { transform: scale(1.06, .94); } 60% { transform: scale(.97, 1.04); } }
.g3-star.come .g3-who { animation: g3come .6s cubic-bezier(.2, .9, .3, 1); }
@keyframes g3come { from { transform: translateX(-60%); opacity: 0; } }

/* 오른쪽 패널 */
.g3-side { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px 18px; min-height: 0; }
.g3-step { display: flex; align-items: baseline; justify-content: space-between; }
.g3-stn { font-family: var(--mono); font-size: 16px; font-weight: 700; color: var(--leaf); }
.g3-name { font-size: 30px; font-weight: 900; letter-spacing: -.04em; line-height: 1.1; }
.g3-verb { font-size: 19px; font-weight: 600; color: var(--k2); line-height: 1.45; min-height: 2.9em; word-break: keep-all; }
.g3-rel { display: table; margin-bottom: 6px; padding: 0 8px; font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--paper); background: var(--leaf); vertical-align: 2px; }
.g3-grow { display: flex; align-items: flex-end; gap: 16px; padding-top: 10px; border-top: 1px solid var(--line); }
.g3-grow .hud .v { font-size: 34px; }
.g3-grow .hud .l { font-size: 16px; color: var(--k2); letter-spacing: .04em; }
.g3-bar { flex: 1; display: flex; gap: 6px; padding-bottom: 8px; }
.g3-bar i { flex: 1; height: 10px; border: 1px solid var(--line2); }
.g3-bar i.on { background: var(--leaf); border-color: var(--leaf); }
.g3-tray { flex: 1; min-height: 96px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.g3-food { width: 96px; height: 96px; padding: 0; border: 0; background: none; transition: transform .12s; }
.g3-food:hover { transform: translateY(-3px); }
.g3-food svg, .g3-fly svg { width: 100%; height: 100%; display: block; overflow: visible; }
.g3-food circle, .g3-fly circle { fill: var(--paper3); stroke: var(--leaf); stroke-width: 2; }
.g3-food text, .g3-fly text { fill: var(--k); font-family: var(--font); font-size: 17px; font-weight: 800; letter-spacing: -.03em; }
.g3-food text.sm, .g3-fly text.sm { font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: .08em; fill: var(--k3); }
.g3-trayt { margin: 0; font-size: 18px; font-weight: 600; color: var(--k2); text-align: center; line-height: 1.45; }
.g3-say { min-height: 28px; font-size: 18px; font-weight: 700; color: var(--leaf); text-align: center; }
.g3-say.on { animation: g3say .5s ease-out; }
@keyframes g3say { from { opacity: 0; transform: translateY(6px); } }
.g3-act { width: 100%; height: 58px; font-size: 21px; }
.g3-fly { position: absolute; z-index: 20; pointer-events: none; }
.g3-hawkfly { object-fit: contain; }

/* 끝 막 */
.g3-endchain { display: flex; justify-content: center; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 22px; color: var(--k); }
.g3-endchain span { color: var(--leaf); font-family: var(--mono); }
.g3-mono { font-family: var(--mono); color: var(--leaf); }

@media (max-height: 700px) {
  .g3 { padding: 10px 16px 12px; gap: 10px; }
  .g3-nimg { width: 44px; height: 44px; }
  .g3-name { font-size: 28px; }
  .g3-side { gap: 8px; padding: 12px 18px 14px; }
  .g3-food { width: 86px; height: 86px; }
  .g3-act { height: 52px; }
}
.g3-win.w1 .g3-sky { right: 13%; }

/* 전자칠판(1920x1080) */
@media (min-height: 900px) {
  .g3 { padding: 16px 24px 22px; gap: 16px; }
  .g3-chain { padding: 12px 24px; }
  .g3-nimg { width: 68px; height: 68px; }
  .g3-nt b { font-size: 26px; }
  .g3-nt span { font-size: 16px; }
  .g3-nt em { font-size: 14px; }
  .g3-chain-l b { font-size: 28px; }
  .g3-side { padding: 22px 26px 24px; gap: 16px; }
  .g3-name { font-size: 42px; }
  .g3-verb { font-size: 24px; }
  .g3-rel { font-size: 18px; }
  .g3-grow .hud .v { font-size: 48px; }
  .g3-food { width: 124px; height: 124px; }
  .g3-trayt, .g3-say { font-size: 23px; }
  .g3-act { height: 72px; font-size: 26px; }
  .g3-hl { font-size: 16px; }
  .g3-grow .hud .l { font-size: 19px; }
  .g3-det > svg.g3-seed { width: 320px; height: 160px; }
  .g3-empty { font-size: 18px; }
}
