:root { color-scheme: dark; --bg: #14161c; --panel: #1d2029; --line: #2c303b; --fg: #e8e6e1; --muted: #9aa0ab; --accent: #7cc3b0; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 -apple-system, "PingFang TC", "Noto Sans TC", sans-serif;
  display: grid; grid-template-columns: 1fr 340px; height: 100vh; height: 100dvh; -webkit-text-size-adjust: 100%; }
main { display: grid; place-items: center; padding: 16px; min-width: 0; }
main { position: relative; }
.sound { position: absolute; top: 24px; right: 24px; z-index: 2; font-size: 18px; line-height: 1; padding: 6px 8px; border-radius: 999px; opacity: 0.75; }
.sound:hover, .sound[aria-pressed=true] { opacity: 1; }
#view { width: 100%; height: auto; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); object-fit: contain; image-rendering: pixelated; border-radius: 6px; }

aside { background: var(--panel); overflow-y: auto; padding: 16px; }
h1 { font-size: 17px; margin: 0 0 8px; }
h2 { font-size: 13px; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
section { border-top: 1px solid var(--line); padding: 12px 0; }
label { display: block; margin: 6px 0; }
#steps label { display: flex; gap: 6px; align-items: flex-start; }
#colors { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; text-align: center; font-size: 12px; margin-top: 8px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=color] { width: 100%; height: 28px; border: 0; background: none; padding: 0; cursor: pointer; }
textarea, select, input[type=number], input:not([type]), #wpUrl { width: 100%; background: #12141a; color: var(--fg); border: 1px solid #333846;
  border-radius: 6px; padding: 6px 8px; font: inherit; }
button { background: #2a2f3b; color: var(--fg); border: 1px solid #3a4050; border-radius: 6px; padding: 6px 10px; font: inherit;
  cursor: pointer; margin-top: 6px; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .6; cursor: wait; }
.row { display: flex; gap: 6px; align-items: flex-end; }
.row > * { flex: 1; }
output { float: right; color: var(--accent); }
.hint { color: var(--muted); font-size: 12px; }
ol.hint { padding-left: 18px; }

body.wp { display: block; background: #000; overflow: hidden; }
body.wp aside { display: none; }
body.wp #view { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; object-fit: cover; }

input[type=file] { width: 100%; font-size: 12px; margin-top: 4px; }
code { background: #12141a; padding: 0 4px; border-radius: 4px; }

#pxPreview { display: block; max-width: 100%; max-height: 220px; margin: 8px 0; image-rendering: pixelated;
  background: repeating-conic-gradient(#3a3f4a 0 25%, #2a2e36 0 50%) 0 0 / 12px 12px; }

/* 分組面板 */
header { padding-bottom: 8px; }
header .hint { margin: 0; }
.top { border-top: 0; padding-top: 4px; }
details { border-top: 1px solid var(--line); padding: 4px 0 10px; }
summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center;
  font-weight: 600; padding: 8px 0; user-select: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "▸"; color: var(--muted); transition: transform .15s; }
details[open] > summary::after { transform: rotate(90deg); }
summary:hover { color: var(--accent); }
h3 { font-size: 12px; color: var(--muted); font-weight: 600; margin: 14px 0 4px; letter-spacing: .02em; }
.chips { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.chips label { margin: 2px 0; }
button.primary { background: #2f5a51; border-color: #3f7a6d; }
#reset { width: 100%; margin-top: 12px; }
#photoBar { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 13px; }
#photoBar[hidden] { display: none; }
body.wp #photoBar { display: none; }
main.drop #view { outline: 3px dashed var(--accent, #7fc4b0); outline-offset: -3px; }

ul.species { list-style: none; padding: 0; margin: 6px 0; font-size: 12px; max-height: 260px; overflow: auto; }
ul.species li { padding: 3px 0; border-bottom: 1px solid var(--line); }
ul.species i { color: var(--muted); }
ul.species .why { display: block; color: var(--muted); }
#geoQ { flex: 1; min-width: 0; }
h1 .lang { float: right; font-size: 12px; padding: 2px 8px; }

/* 新手導覽 */
/* 新手導覽、版本與作者首頁：放在面板最上方、語言切換的下面，不蓋到畫面 */
#corner { clear: both; display: flex; justify-content: flex-end; gap: 10px; align-items: center; margin: 0 0 8px; font-size: 11px; }
#ver { color: var(--muted); text-decoration: none; opacity: .75; }
#ver:hover { color: var(--accent); opacity: 1; }
#tourBtn { margin: 0; font-size: 12px; padding: 4px 10px; border-radius: 99px; opacity: .75; }
#tourBtn:hover, #tourBtn.new { opacity: 1; }
#tourBtn.new { border-color: var(--accent); animation: tourPulse 1.6s ease-in-out infinite; }
@keyframes tourPulse { 50% { box-shadow: 0 0 0 6px rgba(124, 195, 176, .25); } }
#tourBox { position: fixed; z-index: 30; pointer-events: none; border: 2px solid var(--accent); border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .5); transition: all .25s; }
#tourTip { position: fixed; z-index: 31; width: 280px; background: var(--panel); border: 1px solid var(--accent); border-radius: 8px;
  padding: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
#tourTip p { margin: 6px 0 4px; font-size: 13px; }
#tourTip .n { float: right; color: var(--muted); font-size: 12px; }
#tourTip .row { flex-wrap: wrap; }
#tourTip .row > * { flex: 1 0 auto; }
#tourBox[hidden], #tourTip[hidden], body.wp #corner { display: none; }

/* 手機：畫面固定在上方、邊調邊看；觸控目標放大；輸入框 16px 避免 iOS 聚焦時自動放大 */
#inAppBar { background: #3a3220; border: 1px solid #6a5a30; border-radius: 6px; padding: 6px 8px; font-size: 12px; margin-bottom: 8px; }
#inAppBar a { color: var(--accent); font-weight: 600; }
#inAppBar[hidden] { display: none; }
@media (max-width: 760px) {
  body { grid-template-columns: 1fr; height: auto; }
  main { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 8px; padding-top: max(8px, env(safe-area-inset-top)); }
  #view { max-height: 42vh; max-height: 42dvh; }
  aside { padding: 12px max(12px, env(safe-area-inset-right)) calc(64px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  textarea, select, input[type=number], input:not([type]), #wpUrl { font-size: 16px; }
  button { min-height: 40px; }
  label:has(> input[type=checkbox]) { padding: 4px 0; }
  input[type=checkbox] { width: 18px; height: 18px; vertical-align: -4px; }
  summary { padding: 12px 0; }
  #tourBtn { min-height: 32px; }
  #tourTip { left: 8px !important; right: 8px; width: auto; top: auto !important; bottom: max(8px, env(safe-area-inset-bottom)); }
}

button.wide { width: 100%; }
button.chip { font-size: 12px; padding: 3px 10px; border-radius: 99px; min-height: 0; }
button.chip[hidden] { display: none; }

/* 我的作品、最近的照片：縮圖格 */
ul.gallery { list-style: none; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
ul.gallery.small { grid-template-columns: repeat(4, 1fr); gap: 6px; }
ul.gallery li { position: relative; }
ul.gallery .thumb { display: block; width: 100%; margin: 0; padding: 0; overflow: hidden; text-align: left; background: #12141a; min-height: 0; }
ul.gallery img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; image-rendering: pixelated; }
ul.gallery.small img { aspect-ratio: 1; }
ul.gallery .thumb span { display: block; padding: 3px 6px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
ul.gallery small { display: block; color: var(--muted); font-size: 11px; }
ul.gallery .x { position: absolute; top: 3px; right: 3px; margin: 0; padding: 0 6px; min-height: 0; font-size: 11px; line-height: 18px; background: rgba(20, 22, 28, .8); }
#recentPhotos[hidden] { display: none; }
#cloudBar[hidden] { display: none; }
.credit { margin-top: 14px; } .credit a { color: inherit; }
