/* ============================================================================
 *  style.css — AI WORK OS 직원용 웹 (web-01)
 * ----------------------------------------------------------------------------
 *  바깥에서 아무것도 불러오지 않습니다.
 *    - @import 없음
 *    - 웹폰트 없음 (기기에 이미 깔린 글꼴만 씁니다)
 *    - 배경 이미지 URL 없음
 *  이 서버는 인터넷으로 나가지 못합니다. 외부 주소를 한 줄이라도 넣으면
 *  글꼴이 안 나오거나 화면이 몇 초씩 멈춥니다.
 *
 *  화면 크기: 폰 먼저(mobile first). 19명 중 상당수가 폰으로 들어옵니다.
 *  입력칸 글자를 16px 밑으로 내리지 마십시오. 아이폰이 자동으로 화면을
 *  확대해 버려서 그다음 조작이 어려워집니다.
 * ==========================================================================*/

:root {
  color-scheme: light dark;

  --bg:        #f4f6f8;
  --card:      #ffffff;
  --line:      #d9dde3;
  --text:      #1b1f24;
  --muted:     #5d6672;
  --accent:    #1d4ed8;
  --accent-in: #ffffff;

  --ok-bg:     #e9f4ec;  --ok-line:   #2f7d46;
  --warn-bg:   #fdf3e2;  --warn-line: #a9691a;
  --bad-bg:    #fdeceb;  --bad-line:  #b3261e;
  --info-bg:   #eef2fb;  --info-line: #1d4ed8;

  --art-bg:    #e7ebf1;

  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #14171c;
    --card:      #1b1f26;
    --line:      #2c323b;
    --text:      #e7eaee;
    --muted:     #9aa3b0;
    --accent:    #6f9bff;
    --accent-in: #10131a;

    --ok-bg:     #16281c;  --ok-line:   #5bbb7b;
    --warn-bg:   #2b2214;  --warn-line: #d8a24a;
    --bad-bg:    #2d1a19;  --bad-line:  #ef8a82;
    --info-bg:   #191f2e;  --info-line: #8ab0ff;

    --art-bg:    #232833;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", "Noto Sans KR",
               system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
  word-break: keep-all;          /* 한국어 줄바꿈을 단어 단위로 */
  overflow-wrap: break-word;
}

.wrap {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px;
}

.skiplink {
  position: absolute;
  left: -9999px;
}
.skiplink:focus {
  left: 16px; top: 8px;
  z-index: 10;
  background: var(--card);
  border: 2px solid var(--accent);
  padding: 8px 12px;
  border-radius: 8px;
}

/* --- 위쪽 띠 ------------------------------------------------------------ */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar-in {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo {
  width: 32px; height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-in);
  font-weight: 700;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.topbar-text { display: flex; flex-direction: column; line-height: 1.25; flex: 1 1 auto; min-width: 0; }
.topbar-text strong { font-size: 15px; }
.topbar-sub { font-size: 12px; color: var(--muted); }

.conndot {
  width: 10px; height: 10px; border-radius: 50%;
  flex: 0 0 10px;
  background: var(--line);
}
.conndot-ok  { background: var(--ok-line); }
.conndot-bad { background: var(--bad-line); }

/* --- 연결 안내판 -------------------------------------------------------- */
.connpanel {
  max-width: 560px;
  margin: 16px auto 0;
  padding: 18px 16px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: var(--radius);
}
.connpanel h2 { font-size: 18px; margin: 0 0 8px; }
.connpanel h3 { font-size: 14px; margin: 16px 0 4px; }
.connpanel ol { margin: 0; padding-left: 20px; }
.connpanel li { margin-bottom: 4px; }
.connpanel .small { font-size: 13px; color: var(--muted); }
.connpanel .guide { margin-top: 8px; }

/* --- 카드 --------------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 18px 26px;
  margin: 16px 0;
}
.card h1 { font-size: 21px; margin: 0 0 6px; line-height: 1.4; }
.card p  { margin: 0 0 14px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }

.callout {
  background: var(--info-bg);
  border-left: 4px solid var(--info-line);
  border-radius: 6px;
  padding: 12px 14px;
  margin: 0 0 18px;
  font-size: 14px;
}

.tips { padding-left: 20px; margin: 0 0 18px; font-size: 14px; }
.tips li { margin-bottom: 8px; }

.foot-note { font-size: 13px; color: var(--muted); margin-top: 16px; }

/* --- 입력 --------------------------------------------------------------- */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  font: inherit;
  font-size: 16px;               /* 16px 밑으로 내리지 마십시오 (아이폰 자동 확대) */
  padding: 12px 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
input[type="text"]:focus,
input[type="password"]:focus {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

/* 비밀번호 조건 — 치기 전에 먼저 보입니다 */
.rules {
  margin: 0 0 10px;
  padding-left: 20px;
  font-size: 13px;
  color: var(--muted);
}
.rules li { margin-bottom: 2px; }
.sample {
  background: var(--info-bg);
  border-radius: 4px;
  padding: 1px 5px;
}

/* 치는 동안 몇 자인지 */
.meterwrap {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.meter {
  height: 100%;
  width: var(--fill, 0%);
  background: var(--warn-line);
  transition: width .12s linear;
}
.meter-ok { background: var(--ok-line); }

.counter { font-size: 13px; margin: 6px 0 0; color: var(--muted); }
.counter-short { color: var(--warn-line); font-weight: 700; }
.counter-ok    { color: var(--ok-line);   font-weight: 700; }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin: 0 0 18px;
  min-height: 44px;              /* 폰에서 누르기 쉬운 크기 */
  cursor: pointer;
}
.check input { width: 20px; height: 20px; }

.warnline {
  font-size: 13px;
  color: var(--warn-line);
  font-weight: 700;
  margin: -8px 0 14px;
}

/* --- 버튼 --------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  min-height: 48px;              /* 손가락으로 누르는 크기 */
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
}
.btn-main {
  background: var(--accent);
  color: var(--accent-in);
}
.btn-main:disabled {
  background: var(--line);
  color: var(--muted);
  cursor: not-allowed;
}
.btn-quiet {
  background: var(--card);
  color: var(--text);
  border-color: var(--line);
}
.btn-wide { width: 100%; }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.btn.is-busy::before {
  content: "";
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .btn.is-busy::before { animation: none; }
  .meter { transition: none; }
}

.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

/* --- 안내문 ------------------------------------------------------------- */
.noticeslot:empty { display: none; }
.notice {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0 0 16px;
  font-size: 14px;
}
.notice-title { display: block; margin-bottom: 4px; font-size: 15px; }
.notice-msg { margin: 0 !important; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.notice-actions .btn { min-height: 40px; padding: 8px 14px; font-size: 14px; }

.notice-good { background: var(--ok-bg);   border-left-color: var(--ok-line); }
.notice-warn { background: var(--warn-bg); border-left-color: var(--warn-line); }
.notice-bad  { background: var(--bad-bg);  border-left-color: var(--bad-line); }
.notice-info { background: var(--info-bg); border-left-color: var(--info-line); }

.help { margin-top: 18px; font-size: 14px; }
.help summary { cursor: pointer; color: var(--accent); min-height: 44px; display: flex; align-items: center; }
.help p { margin: 4px 0 0; color: var(--muted); }

/* --- 캐릭터 화면 -------------------------------------------------------- */
.avatar-top {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}
.preview { flex: 0 0 120px; }
.preview-art {
  width: 120px;
  height: 150px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--art-bg);
}
.preview-art canvas {
  display: block;
  width: 96px;
  height: 144px;
  margin: 3px auto 0;
  image-rendering: pixelated;
}
.preview-tag {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin: 4px 0 0 !important;
}
.preview-side { flex: 1 1 auto; min-width: 0; }
.preview-side p { margin: 0 0 4px !important; }

.code {
  display: block;
  font-family: "Consolas", "D2Coding", ui-monospace, monospace;
  font-size: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 4px;
  word-break: break-all;
}

.groups { display: flex; flex-direction: column; gap: 6px; }
.group {
  border: none;
  border-top: 1px solid var(--line);
  margin: 0;
  padding: 12px 0 4px;
}
.group legend {
  font-weight: 700;
  font-size: 14px;
  padding: 0;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  font: inherit;
  font-size: 14px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}
.chip-on {
  background: var(--accent);
  color: var(--accent-in);
  border-color: var(--accent);
  font-weight: 700;
}
.chip:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* --- 아래 ---------------------------------------------------------------- */
.foot {
  padding-top: 8px;
  padding-bottom: 32px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.foot p { margin: 2px 0; }

/* --- 작은 글자 없음 (2026-09-22 폰 점검) ---------------------------------
 *  index.html(로그인 · 초대 · 캐릭터)도 사무실 화면과 같이 14px 밑으로 내리지 않습니다.
 *  비밀번호 글자 수 · Caps Lock 경고 · 조건 목록이 13px 이라 폰에서 읽기 어려웠습니다. */
.logo,
.topbar-sub,
.small,
.connpanel .small,
.foot,
.foot-note,
.rules,
.counter,
.warnline,
.preview-tag { font-size: 14px; }

/* --- 화면이 넓을 때 ------------------------------------------------------ */
@media (min-width: 640px) {
  .wrap { max-width: 620px; }
  .card { padding: 28px 28px 32px; }
  .card h1 { font-size: 24px; }
  .actions { flex-direction: row; }
  .actions .btn-wide { width: auto; flex: 1 1 auto; }
}

/* ==========================================================================
 *  오늘의 사무실 (office.html · office.js)
 * --------------------------------------------------------------------------
 *  2D 배치도: 바닥 타일 위에 책상 자리가 격자로 놓이고, 자리마다 캐릭터 ·
 *  이름 · 출근 시각이 있습니다. 바깥 그림 없이 CSS 그라데이션으로만 그립니다.
 *  폰 375px 에서: 가로 스크롤 없음 · 글자 14px 이상 · 누르는 곳 44px 이상.
 * ========================================================================*/
:root {
  --floor-a:   #eef1f5;
  --floor-b:   #e4e8ee;
  --desk:      #c9a77c;
  --desk-edge: #a8845a;
  --me-ring:   var(--accent);
}
@media (prefers-color-scheme: dark) {
  :root {
    --floor-a:   #1d222a;
    --floor-b:   #232933;
    --desk:      #6d5638;
    --desk-edge: #8a6d47;
  }
}

.wrap-wide { max-width: 960px; }
/* 사무실 지도는 넓을수록 잘 보입니다 — 큰 화면에서만 넓힘 */
@media (min-width: 1100px) { .page-office .wrap-wide { max-width: 1240px; } }

/* 이 화면은 작은 글자를 쓰지 않습니다 (14px 이상) */
.page-office .topbar-sub,
.page-office .foot,
.page-office .notice,
.page-office .notice-actions .btn { font-size: 14px; }
.page-office .notice-actions .btn { min-height: 44px; }
.page-office .logo { font-size: 14px; }
.page-office .skiplink { min-height: 44px; display: inline-flex; align-items: center; }
/* 폰에서 배치도에 한 줄 세 자리가 들어가도록 카드 옆 여백을 줄입니다 */
.page-office .card { padding-left: 14px; padding-right: 14px; }

.office-card { overflow: hidden; }
.office-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.office-head-text { min-width: 0; }
.office-head-text p { margin: 0 0 4px; }
.office-status { font-size: 14px; color: var(--muted); }
.office-status-stale { color: var(--warn-line); font-weight: 700; }

.office-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.office-actions .btn { min-height: 48px; font-size: 15px; padding: 10px 12px; }
.office-actions #offAvatar { grid-column: 1 / -1; }

.office-foot { font-size: 14px; margin: 14px 0 0 !important; }

/* 바닥 — 체크무늬 타일 */
.floor-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  background-color: var(--floor-a);
  background-image:
    linear-gradient(45deg, var(--floor-b) 25%, transparent 25%, transparent 75%, var(--floor-b) 75%),
    linear-gradient(45deg, var(--floor-b) 25%, transparent 25%, transparent 75%, var(--floor-b) 75%);
  background-size: 32px 32px;
  background-position: 0 0, 16px 16px;
  padding: 12px;
  min-height: 160px;
}

.floor {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 12px 6px;
}

.seat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 6px 4px 8px;
  border-radius: 10px;
  border: 2px solid transparent;
}
.seat-art {
  width: 64px;
  height: 96px;
  position: relative;
  z-index: 1;
}
.seat-art canvas { display: block; width: 64px; height: 96px; image-rendering: pixelated; }

/* .card p 의 아래 여백(14px)을 자리 안에서는 쓰지 않습니다 */
.floor .seat-name {
  margin: 6px 0 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}
.seat-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.floor .seat-time,
.floor .seat-place {
  margin: 0;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* 나 */
.seat-me {
  border-color: var(--me-ring);
  background: var(--card);
}
/* "나" 표시는 자리 오른쪽 위 모서리에 — 이름 칸을 줄이지 않습니다 */
.me-tag {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  font-size: 14px;
  line-height: 1.2;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-in);
}

.floor-empty {
  text-align: center;
  padding: 32px 8px;
  font-size: 15px;
}
.floor-empty p { margin: 6px 0 0 !important; font-size: 14px; }

/* --- 픽셀 사무실 지도 ----------------------------------------------------
 *  지도는 상자(.map-stage) 안에서만 밀립니다 — 화면 전체는 옆으로 밀리지 않습니다.
 *  이름표는 캔버스 위에 글자로(14px) 얹습니다. 캔버스를 줄여도 글자는 줄지 않습니다. */
.map-tools {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 0 0 8px;
}
.map-tools .btn { min-height: 44px; font-size: 14px; padding: 8px 6px; }
.map-tools .btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.map-stage {
  position: relative;
  max-width: 100%;
  height: 62vh;
  min-height: 300px;
  max-height: 760px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #2a2838;
}
.map-stage.map-fit { height: auto; min-height: 0; max-height: none; overflow-x: hidden; }  /* 오른쪽 끝 방 이름표가 상자를 몇 px 밀어 옆으로 흔들리던 것 */
.map-stage:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.map-inner { position: relative; }
.map-canvas { display: block; image-rendering: pixelated; }
.map-tag {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: none;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(18, 18, 30, 0.82);
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-room { font-weight: 600; background: rgba(18, 18, 30, 0.62); }
.map-ai { background: rgba(150, 62, 18, 0.88); }
.map-me { background: #ffd76a; color: #1b1b24; z-index: 2; }
/* AI 상태 (office.js · GET /api/office/ai-state). 작업 중 표만 마우스를 받습니다(제목 말풍선). */
.map-work {
  background: #1f7a4d;
  color: #fff;
  pointer-events: auto;
  cursor: help;
  z-index: 1;
}
.map-ai.map-idle { background: rgba(90, 70, 60, 0.6); color: #e8e2dc; font-weight: 600; }
.map-ai.map-rest { background: rgba(70, 76, 110, 0.85); }
.map-credit {
  position: sticky;
  left: 0;
  bottom: 0;
  display: inline-block;
  margin: 0 !important;
  padding: 2px 8px;
  font-size: 14px;
  color: #fff;
  background: rgba(18, 18, 30, 0.7);
  border-top-right-radius: 8px;
}
.office-list-title { font-size: 17px; margin: 20px 0 10px; }

/* 걷기 (office.js · office-move.js) — 지도를 누르면 그곳으로, 폰은 방향 단추 */
.map-canvas { cursor: pointer; }
.map-hint { font-size: 14px; margin: 8px 0 0; color: var(--muted, inherit); }
.map-pad {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(2, 56px);
  gap: 6px;
  justify-content: center;
  margin: 10px 0 0;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.map-pad .btn {
  min-height: 56px;
  min-width: 56px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  touch-action: none;
}
.map-pad .pad-up { grid-column: 2; grid-row: 1; }
.map-pad .pad-left { grid-column: 1; grid-row: 2; }
.map-pad .pad-down { grid-column: 2; grid-row: 2; }
.map-pad .pad-right { grid-column: 3; grid-row: 2; }
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  .map-pad { display: none; }
}

@media (min-width: 640px) {
  .map-tools { display: flex; justify-content: flex-end; }
  .office-head { flex-direction: row; align-items: flex-start; justify-content: space-between; }
  .office-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; }
  .office-actions #offAvatar { grid-column: auto; }
  .floor { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 18px 12px; }
  .floor-wrap { padding: 20px; }
  .page-office .card { padding-left: 28px; padding-right: 28px; }
}
