/* 아이패드 앱(2.1.3)과 같은 화면을 만들기 위한 스타일. 단위 px = 앱의 pt (아이패드 가로 높이 768pt 기준으로 전체 확대/축소) */
@font-face { font-family: "DINPro"; src: url("../assets/font/DINPro-Regular.otf"); }

html, body { margin: 0; height: 100%; overflow: hidden; background: #000; }
body { font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
       -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: none; }
#app { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #fff; overflow: hidden; }

.screen { position: absolute; inset: 0; background: #fff; animation: fadein .3s; }
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }

/* 공통 내비게이션 바 (76pt) */
.navbar { position: absolute; left: 0; top: 0; right: 0; height: 76px;
          background: url("../assets/img/common/img_common_back_top@2x.png") repeat-x; background-size: auto 76px; z-index: 5; }
.nav-logo { position: absolute; left: 30px; top: 17px; width: 150px; height: 42px;
            background: url("../assets/img/common/img_common_top_logo@2x.png") no-repeat center / contain; border: 0; padding: 0; cursor: pointer; }
.nav-title { position: absolute; left: 50%; top: 0; height: 76px; line-height: 76px; transform: translateX(-50%);
             font-size: 28px; font-weight: 700; color: #1B2142; white-space: nowrap; }
.nav-title .bullet { display: inline-block; width: 7px; height: 7px; vertical-align: 7px;
                     background: url("../assets/img/common/img_title_bullet@2x.png") no-repeat center / contain; }
.img-btn { position: absolute; border: 0; padding: 0; background: transparent no-repeat center / contain; cursor: pointer; }
.img-btn:active { filter: brightness(.7); }

/* 메인(작품 목록) */
.grid-scroll { position: absolute; left: 0; right: 0; top: 76px; bottom: 0; overflow-y: auto; touch-action: pan-y; }
.grid { display: grid; grid-template-columns: repeat(var(--cols), 175px); justify-content: space-between;
        row-gap: 40px; padding: 63px 78px; }
.cell { position: relative; width: 175px; height: 160px; border-radius: 12px; box-sizing: border-box; cursor: pointer; }
.cell.hl { box-shadow: inset 0 0 0 3px #003662; }
.cell .cap { position: absolute; left: 21.5px; top: 4px; width: 132px; height: 92px; background: #DBFBFF no-repeat center / contain; }
.cell .frame { position: absolute; left: 0; top: 0; width: 175px; height: 112px; background: no-repeat center / contain; }
.cell .name { position: absolute; left: 4px; right: 4px; bottom: 0; top: 114px; display: flex; align-items: flex-end; justify-content: center;
              text-align: center; font-size: 16px; font-weight: 700; color: #1B2142; line-height: 1.2;
              overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; padding-top: 0; }
.cell .menu { position: absolute; right: 0; top: 0; width: 44px; height: 44px; border-radius: 22px; background: #fff; border: 0;
              display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }

/* 대화상자 (프로젝트 메뉴·이름 바꾸기) */
.overlay { position: absolute; inset: 0; background: rgba(0,0,0,.3); z-index: 50; display: flex; align-items: center; justify-content: center; animation: fadein .2s; }
.card { position: relative; width: 300px; max-width: calc(100% - 40px); background: #fff; border-radius: 24px; padding: 24px; box-sizing: border-box;
        display: flex; flex-direction: column; gap: 8px; }
.card .title { min-height: 44px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 44px;
               font-size: 15px; font-weight: 600; color: #1B2142; margin-bottom: 8px; word-break: break-all; }
.card .close { position: absolute; right: 12px; top: 24px; width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; padding: 0;
               display: flex; align-items: center; justify-content: center; }
.pill { min-height: 54px; border-radius: 27px; border: 0; padding: 10px 12px; font-size: 14px; font-weight: 700; cursor: pointer;
        background: #003662; color: #fff; }
.pill.grey { background: #C8C8C8; color: #1B2142; }
.pill:active { filter: brightness(.85); }
.card input { height: 48px; font-size: 17px; color: #1B2142; border: 1px solid #ccc; border-radius: 8px; padding: 0 10px; outline: none; }

/* 시스템 알림 (iOS UIAlertController 모양) */
.alert { width: 270px; background: rgba(250,250,250,.97); border-radius: 14px; overflow: hidden; text-align: center; }
.alert .at { padding: 19px 16px 2px; font-size: 17px; font-weight: 600; color: #000; }
.alert .am { padding: 2px 16px 19px; font-size: 13px; color: #000; }
.alert .ab { display: flex; border-top: 1px solid rgba(60,60,67,.29); }
.alert .ab button { flex: 1; height: 44px; border: 0; background: transparent; font-size: 17px; color: #007AFF; cursor: pointer; }
.alert .ab button + button { border-left: 1px solid rgba(60,60,67,.29); }
.alert .ab button.pref { font-weight: 600; }
.alert .ab button.destructive { color: #FF3B30; }

/* 작업 화면 */
.ws { position: absolute; left: 0; right: 0; top: 76px; bottom: 0; background: #dbfbff; }
.ws-scroll { position: absolute; left: 0; right: 0; top: 0; bottom: 0; overflow: auto; scrollbar-width: none; }
.ws-scroll::-webkit-scrollbar { display: none; }
.ws-canvas { position: relative; }
.category { position: absolute; left: 0; right: 0; bottom: 119px; height: 89px; z-index: 3;
            background: url("../assets/img/stage/img_cate_blcok_back@2x.png") repeat-x; background-size: auto 89px; }
.cat-btn { position: absolute; top: 6px; width: 65px; height: 71px; border: 0; padding: 0; background: no-repeat center / contain; cursor: pointer; }
.toolbox { position: absolute; left: 0; right: 0; bottom: 0; height: 119px; z-index: 3; background: #fff; }
.tb-page { position: absolute; inset: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; touch-action: pan-x; }
.tb-page::-webkit-scrollbar { display: none; }
.tb-page.paged { scroll-snap-type: x mandatory; }
.tb-inner { position: relative; height: 119px; }
.tb-page.paged .tb-inner { background-image: linear-gradient(to right, transparent 0, transparent 100%); }
.block { position: absolute; background: no-repeat 0 0 / 100% 100%; box-sizing: border-box; }
.block.disabled { pointer-events: none; }
.count-btn { position: absolute; bottom: 0; width: 49px; height: 24px; background: url("../assets/img/block/img_coding_block_input@2x.png") no-repeat center / contain;
             font: 500 14px Roboto, -apple-system, sans-serif; color: #666; display: flex; align-items: center; justify-content: center; }
.count-btn.make { font-size: 10px; }
.count-btn.sel { background-image: url("../assets/img/block/img_coding_block_input_selected@2x.png"); color: #fff; }
.ws.dragging .ws-scroll { z-index: 4; }
.block.shadow { pointer-events: none; z-index: 0; }
.ws-canvas .block { touch-action: none; cursor: grab; }
.tb-page .block { touch-action: none; cursor: grab; }

/* 숫자판 (SSCInputNumView) */
.pad-overlay { position: absolute; inset: 0; z-index: 60; }
.numpad { position: absolute; right: 17px; bottom: 228.5px; width: 182px; height: 233px;
          background: url("../assets/img/input_num/img_numberpad_back@2x.png") no-repeat center / 100% 100%; }
.np-btn { position: absolute; width: 44px; height: 44px; border: 0; padding: 0; background: var(--n) no-repeat center / contain; cursor: pointer; }
.np-btn:active { background-image: var(--h); }

/* LED 만들기 (SSCInputLedView) */
.ledpad { position: absolute; left: 50%; top: 50%; width: 452px; height: 454px; transform: translate(-50%, calc(-50% - 61px));
          border: 26px solid transparent; box-sizing: border-box;
          border-image: url("../assets/img/input_led/img_led_make_back@2x.png") 52 fill / 26px stretch; }
.led-title { position: absolute; left: 50%; top: -4px; transform: translateX(-50%); min-width: 160px; padding: 0 22px; height: 46px; line-height: 46px; text-align: center;
             font-size: 20px; font-weight: 700; color: #1B2142; box-sizing: border-box;
             border: 0 solid transparent; border-width: 0 24px; border-image: url("../assets/img/input_led/img_led_make_back_input@2x.png") 0 48 fill / 0 24px stretch; }
.led-grid { position: absolute; left: 50%; top: 50%; width: 289px; height: 289px; transform: translate(-50%, calc(-50% + 4.5px));
            display: grid; grid-template-columns: repeat(8, 30px); gap: 7px; touch-action: none; }
.led-dot { width: 30px; height: 30px; background: url("../assets/img/input_led/img_led_make_dot_off@2x.png") no-repeat center / contain; }
.led-dot.on { background-image: url("../assets/img/input_led/img_led_make_dot_on@2x.png"); }
.led-ok { left: 50%; bottom: -8px; transform: translateX(-50%); width: 94px; height: 50px; }

/* AI 카메라 미리보기 (SSCCameraPreviewView) */
.cam-preview { position: absolute; z-index: 20; background: #000; border-radius: 12px; overflow: hidden; border: 3px solid #00D08E; box-sizing: border-box; touch-action: none; display: none; }
.cam-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam-overlay { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
.cam-skel { right: 8px; top: 8px; z-index: 2; }
.cam-grid { position: absolute; right: 8px; bottom: 8px; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; gap: 2px; pointer-events: none; }
/* 연결 화면 안내 문구 (칸을 하나씩 눌러 연결) */
.conn-hint { text-align: center; color: #003662; font: 700 22px -apple-system, system-ui, sans-serif; pointer-events: none; }
/* 크기 조절 손잡이: 왼쪽 아래, 대각선 화살표 */
.cam-resize { position: absolute; left: 0; bottom: 0; width: 34px; height: 34px; z-index: 3; cursor: nesw-resize; touch-action: none;
  background: #00D08E; border-top-right-radius: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 4h5v5M9 20H4v-5M20 4l-6.5 6.5M4 20l6.5-6.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 20px 20px; }
.cam-cell { background: no-repeat center / contain; display: none; }

/* 공통 글자 버튼 · iOS 스위치 · 빙글이 */
.txt-btn { border: 0; cursor: pointer; white-space: nowrap; }
.txt-btn:active { filter: brightness(.85); }
.ios-switch { position: relative; width: 51px; height: 31px; border-radius: 16px; background: #e9e9eb; cursor: pointer; transition: background .2s; flex: none; }
.ios-switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: left .2s; }
.ios-switch.on { background: #0071B1; }
.ios-switch.on::after { left: 22px; }
.spinner { position: absolute; right: 16px; top: 16px; width: 18px; height: 18px; border: 2.5px solid rgba(0,0,0,.08); border-top-color: #888; border-radius: 50%; animation: spin .8s linear infinite; display: none; box-sizing: border-box; }
@keyframes spin { to { transform: rotate(360deg); } }
.deco, .set-icon, .set-cube { position: absolute; background: no-repeat center / 100% 100%; }

/* 설정 */
.set-container { background: #fff; }
.set-tabs { position: absolute; left: 50%; transform: translateX(-50%); display: flex; gap: 15px; }
.set-tab { height: 60px; padding: 0 12px; border: 0; border-radius: 10px 10px 0 0; background: #C8C8C8; color: #f0f0f0; font: 700 18.75px -apple-system, system-ui, sans-serif;
           display: flex; align-items: center; cursor: pointer; white-space: nowrap; }
.set-tab.on { background: #0071B1; color: #fff; }
.set-tab .ic { display: inline-block; width: 49.5px; height: 45px; background: no-repeat center / contain; margin-right: 2px; }
.set-label { position: absolute; left: 0; right: 0; top: 42px; text-align: center; color: #0071B1; font-size: 22.5px; }
.sl { background: #DEE7EA; border-radius: 10px; }
.sl-track { position: absolute; left: 15px; right: 105px; top: 30px; height: 15px; border-radius: 7.5px; background: #b8c3c8; cursor: pointer; touch-action: none; }
.sl-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 7.5px; background: #0071B1; }
.sl-thumb { position: absolute; top: -15px; width: 45px; height: 45px; background: url("../assets/img/setting/img_setting_signal_controller@2x.png") no-repeat center / contain; }
.sl.off .sl-fill { background: #C8C8C8; }
.sl.off .sl-thumb { background-image: url("../assets/img/setting/img_disabled_thumb@2x.png"); }
.sl.off .sl-track { cursor: default; }
.sl-val { position: absolute; right: 15px; top: 15px; bottom: 15px; width: 75px; box-sizing: border-box; background: #fff; border: 1.5px solid #0071B1; border-radius: 5px;
          display: flex; align-items: center; justify-content: center; color: #0071B1; font: 900 19.375px -apple-system, system-ui, sans-serif; }
.set-cube.spin::after { content: ""; position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px; border: 2.5px solid rgba(0,0,0,.08); border-top-color: var(--spin); border-radius: 50%; animation: spin .8s linear infinite; box-sizing: border-box; }
.set-use { position: absolute; bottom: 0; height: 60px; display: flex; align-items: center; gap: 15px; color: #0071B1; font-size: 17px; }
.set-event { position: absolute; display: flex; align-items: center; gap: 12px; color: #0071B1; font-size: 22.5px; }
.set-light { position: absolute; box-sizing: border-box; background: #fff; border: 3px solid #0071B1; border-radius: 12px; display: flex; align-items: center; justify-content: center;
             color: #0071B1; font: 700 23.75px -apple-system, system-ui, sans-serif; }

/* 연결 */
.conn-cell { cursor: pointer; }
.conn-img { background: no-repeat center / contain; }
.conn-badge { position: absolute; background: no-repeat center / contain; display: none; }
.conn-label { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font: 700 13px -apple-system, system-ui, sans-serif; }

/* 그룹 */
.grp-frame { box-sizing: border-box; border: solid transparent; border-width: 22px 21px 21px 22px;
              border-image: url("../assets/img/group/img_block_number_input@2x.png") 44 42 42 44 fill / 22px 21px 21px 22px stretch; }
.grp-input { box-sizing: border-box; border: 0; font: 50px DINPro, sans-serif; color: #4C515A; text-align: center; outline: none; padding: 0; background: transparent; }

/* 도움말 */
.guide-tabs { display: flex; }
.guide-tab { flex: 1; border: 0; box-sizing: border-box; border-style: solid; border-color: transparent; border-width: 0 2px 0 3px;
             border-image: url("../assets/img/guide/img_tab@2x.png") 0 4 0 6 fill / 0 2px 0 3px stretch;
             display: flex; align-items: center; justify-content: center; font: 600 16px -apple-system, system-ui, sans-serif; color: #1B2142; cursor: pointer; padding: 0; }
.guide-tab.on { border-image-source: url("../assets/img/guide/img_tab_selected@2x.png"); }
.guide-tab .ic { width: 35px; height: 34px; background: no-repeat center / contain; }
.guide-content { overflow: hidden; }
.guide-title { font: 700 28px -apple-system, system-ui, sans-serif; color: #0071B1; white-space: nowrap; }
.guide-about { display: flex; align-items: center; font-size: 17px; color: #000; line-height: 1.2; }
.guide-about-b { font-size: 17px; color: #000; line-height: 1.2; }
.gb-cell { border-bottom: 1px solid #AEAEAE; box-sizing: border-box; }
.gb-img { background: no-repeat center / contain; }
.gb-text { position: absolute; left: 100px; right: 0; }
.gb-title { display: inline-block; background: #FFF194; color: #404040; font: 700 18px -apple-system, system-ui, sans-serif; }
.gb-body { color: #666; font-size: 11.25px; margin: 8px 0 0 4px; line-height: 1.25; }
.gb-warn { display: flex; align-items: center; color: #E34544; font-size: 11.25px; margin: 4px 0 0 4px; }
.gb-warn span { width: 16px; height: 16px; background: url("../assets/img/guide/img_exclamation_mark@2x.png") no-repeat center / contain; flex: none; }
.gb-bubble { position: absolute; left: 1px; height: 35px; box-sizing: border-box; padding: 0 16px 8px; display: flex; align-items: center; white-space: nowrap;
             color: #fff; font: 700 14px -apple-system, system-ui, sans-serif; z-index: 0; }
.gb-bubble::before { content: ""; position: absolute; inset: 0; z-index: -1; border: 0 solid transparent; border-width: 0 9px 0 60px;
             border-image: url("../assets/img/guide/img_bubble@2x.png") 0 18 0 120 fill / 0 9px 0 60px stretch; }
.guide-bubble-pad { padding-left: 0; }
.guide-if { position: absolute; color: #434343; font-size: 11.25px; line-height: 1.3; }
.guide-list { overflow-y: auto; touch-action: pan-y; scrollbar-width: none; }
.guide-list::-webkit-scrollbar { display: none; }
.gl-header { position: relative; background: #fff; }
.gl-title { position: absolute; left: 0; height: 27px; line-height: 27px; background: #1B2142; color: #FFED76; font: 700 15px -apple-system, system-ui, sans-serif; white-space: nowrap; }
.gl-line { position: absolute; left: 0; right: 0; height: 1px; background: #1B2142; }
.gl-sub { position: absolute; left: 16px; bottom: 0; font: 700 11.25px -apple-system, system-ui, sans-serif; color: #666; }
.gl-warning { position: absolute; left: 4px; top: 0; height: 17px; display: flex; align-items: center; color: #E34544; font-size: 11.25px; }
.gl-warning span { width: 16px; height: 16px; background: url("../assets/img/guide/img_exclamation_mark@2x.png") no-repeat center / contain; }
.gl-grid { display: grid; row-gap: 8px; padding: 16px 0; }
.gl-row { height: 60px; display: flex; align-items: center; }
.gl-ic { margin-left: 16px; background: no-repeat center / 100% 100%; flex: none; }
.gl-tx { margin-left: 16px; font-size: 11.25px; color: #000; line-height: 1.3; }
.gl-tx b { color: #666; }
.gl-footer { height: 1px; }
.cat-btn.connecting::after { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px; border: 2.5px solid rgba(255,255,255,.5); border-top-color: #888; border-radius: 50%; animation: spin .8s linear infinite; box-sizing: border-box; }
.noanim *, .noanim { animation: none !important; transition: none !important; }
