/* ============================================================
   水晶公 · FF14 水晶都 / 暗影之逆焰主题（像素风版）
   永夜深蓝 + 水晶青光 + 金色灯火，文字与对话框保留像素风：
   直角 / 粗实线边框 / 硬投影，配色与地图横幅不变
   页面对应第一世界地图：
     日历→雷克兰德  记录→安缪埃兰  消息→妖灵乡  我的→拉凯提卡大森林
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 缝合像素字体（简体中文），来自 TakWolf/fusion-pixel-font */
@font-face {
  font-family: "Fusion Pixel";
  src: url("vendor/fusion-pixel-zh_hans.woff2") format("woff2");
  font-display: swap;
}

:root {
  --night: #0D1230;          /* 永夜深蓝 */
  --night-2: #1A2150;        /* 夜空渐变次色 */
  --panel: rgba(17, 24, 58, .92);   /* 深蓝面板 */
  --panel-2: rgba(28, 38, 84, .92); /* 面板亮部 */
  --crystal: #6FD3F7;        /* 水晶青 */
  --crystal-deep: #2E8FC4;   /* 水晶青深 */
  --gold: #E8C77D;           /* 水晶都金 */
  --gold-deep: #B9924A;
  --ink: #EAF0FF;            /* 主文字（月白） */
  --ink-sub: #9AA6D6;        /* 次要文字 */
  --line: rgba(111, 211, 247, .35); /* 水晶描边 */
  --shadow: 3px 3px 0 rgba(0, 0, 0, .5);   /* 像素硬投影（对话框/按钮） */
  --shadow-lg: 4px 4px 0 rgba(0, 0, 0, .5); /* 像素硬投影（大面板） */
  --red: #E06456;
}

html, body { height: 100%; }
body {
  font-family: "Fusion Pixel", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: radial-gradient(ellipse at 50% -10%, #2A3468 0%, var(--night-2) 45%, var(--night) 100%);
  display: flex; justify-content: center;
}
.view { width: 100%; max-width: 480px; min-height: 100vh; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* 像素面板：深蓝半透 + 青色实线边 + 硬投影，直角无圆角 */
.sd-panel {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 0;
  box-shadow: var(--shadow-lg), inset 0 2px 0 rgba(234, 240, 255, .08);
}

/* ---------- 登录（水晶塔背景） ---------- */
#view-login {
  position: relative; overflow: hidden;
  justify-content: center; padding: 28px 24px;
  background: url("assets/bg-crystarium.jpg") center / cover no-repeat;
}
#view-login::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(13, 18, 48, .30), rgba(13, 18, 48, .68));
  pointer-events: none;
}
.login-box {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: 12px; padding: 28px 22px;
  background: rgba(13, 18, 48, .85);
  border: 2px solid var(--line); border-radius: 0;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, .55), inset 0 2px 0 rgba(234,240,255,.12);
}
.logo {
  font-size: 42px; font-weight: 800; text-align: center; letter-spacing: 6px;
  background: linear-gradient(180deg, #FFF6D8, var(--gold) 55%, #C89A4E);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, .55));
  margin-bottom: 2px;
}
.slogan {
  color: var(--crystal); text-align: center; margin-bottom: 14px; font-size: 13px;
  letter-spacing: 2px; text-shadow: 2px 2px 0 rgba(0, 0, 0, .6);
}

/* ---------- 通用 ---------- */
.input {
  width: 100%; padding: 12px 14px;
  border: 2px solid var(--line); border-radius: 0;
  background: rgba(10, 14, 38, .8); color: var(--ink);
  font-size: 15px; outline: none; font-family: inherit;
}
.input::placeholder { color: #6B76A8; }
.input:focus { border-color: var(--crystal); box-shadow: 3px 3px 0 rgba(111, 211, 247, .35); }
.btn {
  border: 2px solid var(--line); border-radius: 0; padding: 12px 16px;
  font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit;
  background: var(--panel-2); color: var(--ink);
  box-shadow: var(--shadow); transition: filter .1s;
}
/* 像素按钮：按下时位移 + 阴影收拢，模拟实体按压 */
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0, 0, 0, .5); filter: brightness(1.2); }
.btn-primary {
  background: #4FB8E8;
  border-color: #B4E6FF; color: #061224;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, .35);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .5);
}
.btn-secondary { background: rgba(46, 60, 110, .85); color: var(--gold); border-color: rgba(232, 199, 125, .4); }
.btn-danger { background: rgba(96, 30, 30, .7); color: #FFB3AA; border-color: rgba(224, 100, 86, .5); }
.btn-small { padding: 7px 13px; font-size: 13px; border-radius: 0; }
.btn-block { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: .55; cursor: wait; }
.tip {
  color: var(--crystal); font-size: 13px; text-align: center; min-height: 18px; margin-top: 6px;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .6);
}

/* ---------- 主视图布局 ---------- */
#view-main { height: 100vh; }
.page { flex: 1; overflow-y: auto; padding: 0 16px 84px; }

/* 地区横幅：每页一张第一世界地图 */
.page-banner {
  margin: 0 -16px 14px; padding: 18px 16px 14px;
  background-size: cover; background-position: center;
  border-bottom: 2px solid var(--line);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .45), inset 0 -40px 40px -30px var(--night);
}
#page-calendar .page-banner { background-image: linear-gradient(180deg, rgba(13,18,48,.15), rgba(13,18,48,.75)), url("assets/banner-lakeland.jpg"); }
#page-records  .page-banner { background-image: linear-gradient(180deg, rgba(13,18,48,.15), rgba(13,18,48,.75)), url("assets/banner-amhraeng.jpg"); }
#page-messages .page-banner { background-image: linear-gradient(180deg, rgba(13,18,48,.15), rgba(13,18,48,.75)), url("assets/banner-ilmheg.jpg"); }
#page-profile  .page-banner { background-image: linear-gradient(180deg, rgba(13,18,48,.15), rgba(13,18,48,.75)), url("assets/banner-rakhtika.jpg"); }

.page-head { display: flex; justify-content: space-between; align-items: center; }
.page-head h2 {
  font-size: 24px; letter-spacing: 4px; color: #FFF6D8;
  text-shadow: 0 0 12px rgba(232, 199, 125, .55), 0 2px 6px rgba(0, 0, 0, .7);
}
.page-sub {
  color: var(--ink-sub); font-size: 13px; margin: 0 2px 12px; line-height: 1.6;
}

/* ---------- 底部导航（水晶栈桥） ---------- */
#tabbar {
  position: fixed; bottom: 0; width: 100%; max-width: 480px;
  display: flex; padding-bottom: env(safe-area-inset-bottom);
  background: rgba(10, 14, 38, .96);
  border-top: 2px solid var(--line);
  box-shadow: 0 -3px 0 rgba(0, 0, 0, .45);
}
.tab {
  flex: 1; background: none; border: none; padding: 9px 0 7px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 21px; color: #67719F; font-family: inherit;
  filter: grayscale(.55);
}
.tab span { font-size: 11px; font-weight: 600; letter-spacing: 1px; }
.tab.active {
  color: var(--crystal); filter: none;
  text-shadow: 0 0 10px rgba(111, 211, 247, .8);
}
.tab.active span { color: var(--gold); text-shadow: 0 0 8px rgba(232, 199, 125, .6); }

/* ---------- 日历 ---------- */
.month-nav { display: flex; align-items: center; gap: 10px; }
.month-label {
  font-size: 16px; font-weight: 700; min-width: 96px; text-align: center;
  color: #FFF6D8; text-shadow: 0 1px 6px rgba(0, 0, 0, .8), 0 0 10px rgba(232, 199, 125, .4);
}
.week-row {
  display: grid; grid-template-columns: repeat(7, 1fr); text-align: center;
  color: var(--crystal); font-size: 12px; margin: 8px 0 6px;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .6);
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-cell {
  aspect-ratio: 1; border: 1px solid rgba(111, 211, 247, .18); border-radius: 0;
  background: rgba(20, 28, 64, .72); color: var(--ink);
  font-size: 13px; cursor: pointer; font-family: inherit;
}
.cal-cell.has-mine {
  background: rgba(232, 199, 125, .22); border-color: rgba(232, 199, 125, .65);
  color: #FFEFC5;
}
.cal-cell.has-shared {
  background: rgba(160, 120, 235, .22); border-color: rgba(178, 140, 255, .6);
  color: #E4D5FF;
}
.cal-cell.selected {
  background: rgba(111, 211, 247, .45);
  border-color: var(--crystal); color: #FFFFFF; font-weight: 700;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .45);
}
.day-head { font-size: 15px; font-weight: 700; margin: 16px 2px 10px; color: var(--crystal); text-shadow: 1px 1px 0 rgba(0,0,0,.6); }
.day-list { display: flex; flex-direction: column; gap: 9px; }
.day-item {
  background: var(--panel); border: 2px solid var(--line); border-radius: 0;
  box-shadow: var(--shadow); padding: 12px 14px;
}
.day-item .t { font-size: 15px; font-weight: 700; }
.day-item .s { font-size: 12px; color: var(--ink-sub); margin-top: 3px; }
.day-item .s.friend { color: #B28CFF; text-shadow: 1px 1px 0 rgba(0,0,0,.5); }
.day-item .del {
  float: right; background: none; border: none; color: var(--red);
  font-size: 13px; cursor: pointer; font-family: inherit;
}
.fab { margin-top: 16px; }

/* ---------- 列表卡片 ---------- */
.card-list { display: flex; flex-direction: column; gap: 9px; margin-bottom: 14px; }
.card {
  background: var(--panel); border: 2px solid var(--line); border-radius: 0;
  box-shadow: var(--shadow-lg); padding: 14px; margin-bottom: 14px;
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; color: var(--gold); }
.card-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 2px;
  border-bottom: 1px dashed rgba(111, 211, 247, .2); cursor: pointer;
}
.card-item:last-child { border-bottom: none; }
/* 头像框：像素方框，将来放人物立绘 */
.avatar {
  width: 44px; height: 44px; border-radius: 0;
  background: linear-gradient(135deg, #2A3468, #141B3D);
  color: var(--crystal); border: 2px solid var(--crystal);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .5);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.item-main { flex: 1; min-width: 0; }
.item-name { font-size: 15px; font-weight: 600; }
.item-sub { font-size: 12px; color: var(--ink-sub); margin-top: 3px; }
.badge {
  background: rgba(232, 199, 125, .18); color: var(--gold);
  border: 1px solid rgba(232, 199, 125, .5);
  font-size: 11px; border-radius: 0; padding: 3px 8px;
}
.badge.green { background: rgba(178, 140, 255, .18); color: #CBB2FF; border-color: rgba(178, 140, 255, .5); }
.del-btn { background: none; border: none; color: var(--red); font-size: 13px; cursor: pointer; flex-shrink: 0; }
.arrow { color: #67719F; font-size: 20px; }

.invite-row { display: flex; align-items: center; justify-content: space-between; }
.invite-code {
  font-size: 24px; font-weight: 800; color: var(--crystal); letter-spacing: 3px;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, .6);
}
.empty {
  color: var(--ink-sub); font-size: 13px; text-align: center;
  padding: 24px 14px; line-height: 1.8;
}

/* ---------- 聊天 ---------- */
#view-chat {
  position: relative; overflow: hidden;
  height: 100vh;
  background: url("assets/banner-ilmheg.jpg") center / cover no-repeat;
}
#view-chat::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(13, 18, 48, .55), rgba(13, 18, 48, .88));
  pointer-events: none;
}
#chat-head {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: rgba(10, 14, 38, .92);
  border-bottom: 2px solid var(--line); font-weight: 700; color: #FFF6D8;
}
#chat-list {
  position: relative; z-index: 1; flex: 1; overflow-y: auto;
  padding: 14px 12px; display: flex; flex-direction: column; gap: 9px;
}
.msg-row { display: flex; flex-direction: column; max-width: 78%; }
.msg-row.mine { align-self: flex-end; align-items: flex-end; }
.msg-row.theirs { align-self: flex-start; align-items: flex-start; }
.msg-name { font-size: 11px; color: var(--ink-sub); margin: 0 4px 3px; }
.msg-bubble {
  padding: 10px 13px; font-size: 15px; line-height: 1.5; word-break: break-word;
  border-radius: 0;
}
.mine .msg-bubble {
  background: #4FB8E8;
  color: #061224; font-weight: 600; border: 2px solid #B4E6FF;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .45);
}
.theirs .msg-bubble {
  background: var(--panel); color: var(--ink);
  border: 2px solid var(--line); box-shadow: var(--shadow);
}
#chat-input-row {
  position: relative; z-index: 1;
  display: flex; gap: 8px; padding: 12px;
  background: rgba(10, 14, 38, .92);
  border-top: 2px solid var(--line);
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

/* ---------- 模态框（像素对话框） ---------- */
#modal-overlay {
  position: fixed; inset: 0; background: rgba(4, 6, 20, .7); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
#modal-box {
  width: 100%; max-width: 480px;
  background: #1C2654;
  border: 2px solid var(--crystal); border-radius: 0;
  box-shadow: 0 -4px 0 rgba(0, 0, 0, .5), inset 0 2px 0 rgba(234,240,255,.1);
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  max-height: 88vh; overflow-y: auto;
}
#modal-box h3 { margin-bottom: 14px; font-size: 19px; color: var(--gold); letter-spacing: 2px; text-shadow: 2px 2px 0 rgba(0,0,0,.6); }
#modal-box .field-label { font-size: 13px; font-weight: 600; margin: 12px 0 5px; color: var(--crystal); }
#modal-box textarea {
  width: 100%; min-height: 90px; padding: 10px 14px;
  border: 2px solid var(--line); border-radius: 0;
  background: rgba(10, 14, 38, .8); color: var(--ink);
  font-size: 15px; font-family: inherit; outline: none; resize: vertical;
}
.switch-row { display: flex; justify-content: space-between; align-items: center; margin: 14px 0; }
.switch-row .hint { font-size: 12px; color: var(--ink-sub); margin-top: 3px; }
/* 像素开关：方形滑块 */
.switch { position: relative; width: 50px; height: 28px; flex-shrink: 0; }
.switch input { display: none; }
.switch .slider {
  position: absolute; inset: 0; background: #232C5E;
  border: 2px solid var(--line); border-radius: 0;
  cursor: pointer; transition: .15s;
}
.switch .slider::before {
  content: ""; position: absolute; width: 20px; height: 20px;
  background: #C8EEFF; border-radius: 0; top: 2px; left: 3px; transition: .15s;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .4);
}
.switch input:checked + .slider { background: rgba(46, 143, 196, .55); border-color: var(--crystal); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
.photo-preview {
  max-width: 100%; max-height: 200px; margin-top: 10px; display: block;
  border: 2px solid var(--line); border-radius: 0; box-shadow: var(--shadow);
}

/* ---------- Toast（像素提示框） ---------- */
#toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%);
  background: rgba(13, 18, 48, .95); color: var(--crystal);
  border: 2px solid var(--crystal); border-radius: 0;
  font-size: 14px; padding: 11px 18px; z-index: 99; max-width: 82%;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, .55);
  text-align: center;
}

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2E3C74; border-radius: 0; }

/* ============================================================
   生日特别界面（仅水晶公_1017）
   ============================================================ */
#view-birthday {
  position: relative; overflow: hidden;
  justify-content: center; align-items: center;
  padding: 28px 24px;
  background: url("assets/bg-crystarium.jpg") center / cover no-repeat;
}
#view-birthday::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(13,18,48,.15), rgba(13,18,48,.72));
  pointer-events: none;
}
.birthday-panel {
  position: relative; z-index: 1;
  padding: 30px 24px; text-align: center;
  background: rgba(13,18,48,.88);
  border: 2px solid var(--gold);
  box-shadow: 6px 6px 0 rgba(0,0,0,.55), 0 0 30px rgba(232,199,125,.3);
}
.birthday-title {
  font-size: 32px; color: var(--gold); letter-spacing: 4px;
  text-shadow: 3px 3px 0 rgba(0,0,0,.6), 0 0 16px rgba(232,199,125,.5);
  margin-bottom: 8px;
}
.birthday-sub {
  font-size: 14px; color: var(--crystal); letter-spacing: 2px;
  text-shadow: 2px 2px 0 rgba(0,0,0,.5);
  margin-bottom: 20px;
}
.birthday-text {
  font-size: 15px; line-height: 2; color: var(--ink);
  margin-bottom: 24px;
}

/* ============================================================
   点击式小游戏
   ============================================================ */
#view-game { height: 100vh; background: var(--night); }
.game-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: rgba(10,14,38,.94);
  border-bottom: 2px solid var(--line);
}
.game-header span { font-size: 16px; color: var(--gold); letter-spacing: 2px; text-shadow: 2px 2px 0 rgba(0,0,0,.6); }
#game-stage {
  flex: 1; display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.game-scene {
  flex: 1; background: #0D1230 center / cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-sub); font-size: 14px;
}
.game-dialogue {
  background: rgba(13,18,48,.95);
  border-top: 2px solid var(--line);
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  min-height: 130px; display: flex; flex-direction: column;
}
.game-speaker {
  font-size: 13px; color: var(--gold); font-weight: 700;
  margin-bottom: 6px; letter-spacing: 1px;
}
.game-text {
  font-size: 15px; line-height: 1.8; color: var(--ink);
  flex: 1;
}
.game-choices {
  display: flex; flex-direction: column; gap: 8px; margin-top: 10px;
}
.game-choices .btn { font-size: 14px; padding: 10px 14px; }
.game-next {
  text-align: right; font-size: 12px; color: var(--ink-sub);
  margin-top: 8px; cursor: pointer; user-select: none;
}
.game-next:hover { color: var(--crystal); }

/* ============================================================
   旅行地图（旅行日志分类专用）
   ============================================================ */
.travel-map {
  margin: 0 -16px 14px; padding: 0 16px;
}
.travel-map-title {
  font-size: 13px; color: var(--crystal); margin-bottom: 10px; letter-spacing: 1px;
}
.travel-map-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.travel-region {
  border: 2px solid var(--line); border-radius: 0;
  padding: 12px 10px; cursor: pointer;
  background: rgba(20,28,64,.72);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  box-shadow: var(--shadow);
  transition: filter .1s;
}
.travel-region:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 rgba(0,0,0,.5); }
.travel-region .r-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.travel-region .r-sub { font-size: 11px; color: var(--ink-sub); }
.travel-region.lit {
  border-color: var(--gold);
  background: rgba(232,199,125,.12);
  box-shadow: 0 0 12px rgba(232,199,125,.3);
}
.travel-region.lit .r-name { color: var(--gold); }
.travel-region.selected {
  border-color: var(--crystal);
  background: rgba(111,211,247,.15);
  box-shadow: 0 0 12px rgba(111,211,247,.4);
}

/* 日程时间段显示 */
.day-item .t .time-range {
  color: var(--gold); font-size: 13px; margin-right: 4px;
}
