:root {
  color-scheme: light;
  scroll-padding-bottom: 85px;
  font-family: system-ui, "Yu Gothic UI", "Noto Sans CJK JP", Meiryo, sans-serif;
  --ink: #233744;
  --muted: #526d7b;
  --blue: #216d84;
  --accent: #167b9b;
  --line: #c5d9e0;
  --paper: #f8fcfd;
  --panel: #edf7fa;
  --well: #dcebf0;
  --rim: #fbfefe;
  --chrome: #f3f9fa;
  --backdrop: #cde5ef;
  --shadow: #233e5522;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  display: flow-root;
  min-width: 280px;
  min-height: 100vh;
  color: var(--ink);
  background: radial-gradient(ellipse at 18% 6%, #f0fcf9 0, transparent 47%),
    radial-gradient(ellipse at 92% 86%, #b1d8e7 0, transparent 57%), var(--backdrop);
  font-size: 16px;
  line-height: 1.5;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-radial-gradient(ellipse at 76% -8%, transparent 0 74px, #ffffff21 75px 77px, transparent 78px 126px);
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .35; cursor: default; }
a { color: var(--blue); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(23px, 3.1vw, 36px); letter-spacing: -.035em; line-height: 1.16; }
h2 { font-size: 22px; letter-spacing: -.025em; line-height: 1.25; }
img { display: block; }
.skip { position: absolute; top: 8px; left: 8px; padding: 8px; z-index: 10; background: var(--paper); transform: translateY(-150%); }
.skip:focus { transform: none; }

.shell {
  position: relative;
  width: min(1040px, calc(100% - 48px));
  margin: clamp(16px, 5vh, 48px) auto;
  border: 1px solid #adc9d5;
  border-radius: 34px;
  background: var(--chrome);
  box-shadow: 0 18px 50px #224b6322, 0 2px 7px #2349501c, inset 0 1px 1px #fff9;
}
.console-header, .control-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-inline: clamp(18px, 3vw, 32px);
}
.console-header { min-height: 79px; gap: 12px; }
.brand, .console-status { display: flex; align-items: center; min-width: 0; }
.brand { gap: 12px; font-size: 22px; letter-spacing: .025em; white-space: nowrap; }
.brand-mark {
  width: 43px;
  height: 43px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 15px;
  border: 1px solid #356d87;
  background: linear-gradient(145deg,#4b819b,#234d68);
  box-shadow: 0 2px 2px var(--shadow), inset 0 1px 0 #ffffff55;
}
.brand-mark img { width: 24px; }
.brand-sub { margin-left: 8px; font-size: 13px; font-weight: 680; color: var(--muted); letter-spacing: .015em; }
.console-status { justify-content: end; gap: 13px; }
.system-status { display: flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; color: var(--muted); }
.system-status i { width: 8px; height: 8px; border-radius: 50%; background: #338659; box-shadow: 0 0 0 3px #53a17822; }
.system-status.offline i { background: #9c6228; box-shadow: 0 0 0 3px #a1775322; }
.user-button {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 5px 12px 5px 7px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.user-button img { width: 24px; height: 24px; border-radius: 50%; background: #dbeef3; padding: 4px; }
.user-button span { max-width: 112px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main {
  margin: 0 12px;
  padding: 12px clamp(13px, 3.2vw, 36px) clamp(16px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg,var(--paper),var(--panel) 74%);
  box-shadow: 0 1px 1px #fff9, inset 0 1px 5px #1937480c;
  outline: none;
}
.breadcrumb { min-height: 24px; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.breadcrumb:has(> :only-child) { display: none; }
.breadcrumb button { border: 0; background: transparent; color: var(--blue); padding: 0 1px; }
.breadcrumb img { width: 12px; opacity: .68; }
.breadcrumb span[aria-current] { font-weight: 700; }

.launcher-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-block: 10px 20px; }
.clock-card { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 16px; padding: 6px 11px 6px 7px; background: var(--paper); color: var(--ink); white-space: nowrap; }
.clock-face { position: relative; width: 36px; height: 36px; flex: none; border: 1px solid #abc9d5; border-radius: 50%; background: #edf8fc; }
.clock-interior { position: absolute; inset: 4px; }
.clock-interior::after { content: ""; position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #26617a; inset: calc(50% - 2px); }
.hand { position: absolute; bottom: 50%; left: calc(50% - 1px); width: 2px; height: 8px; border-radius: 5px; background: #26617a; transform-origin: bottom; }
.hand.minute { height: 11px; background: #4c7990; }
.clock-time { font-size: 20px; font-weight: 760; line-height: 1; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.clock-date { color: var(--muted); font-size: 11px; margin-top: 2px; }

.launcher-board, .category-carousel { display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; gap: 10px; align-items: center; }
.launcher-board { touch-action: pan-y; }
.tiles {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: clamp(7px, 1.4vw, 13px);
  padding: clamp(8px, 1.4vw, 15px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--well);
  box-shadow: inset 0 1px 5px #16365212, 0 1px 0 var(--rim);
}
.tile, .tile-slot {
  min-width: 0;
  min-height: clamp(107px, 14vh, 145px);
  border-radius: 17px;
}
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 12px 4px;
  text-align: center;
  background: linear-gradient(var(--paper),var(--panel));
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 var(--rim), 0 2px 0 #32536620, 0 3px 6px #263e5111;
  transition: transform .17s ease, box-shadow .17s ease, border-color .17s ease, background .17s ease;
}
.tile:active { transform: translateY(1px); }
.tile[data-selected] {
  border-color: #2789ab;
  box-shadow: 0 0 0 2px #2789ab, inset 0 0 0 3px var(--paper), 0 3px 12px #247d9c4a;
  background: var(--paper);
  z-index: 1;
}
.tile:focus-visible { outline-offset: 4px; }
.tile-title { font-size: clamp(12px, 1.6vw, 16px); font-weight: 730; line-height: 1.25; white-space: normal; overflow-wrap: anywhere; }
.tile-slot { border: 1px dashed #8da9b570; background: #ffffff22; box-shadow: inset 0 1px 2px #183e4c0a; }
.icon-box {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  border: 1px solid #516f8729;
  background: linear-gradient(140deg,#f2fbff,#caddf2);
  box-shadow: 0 2px 3px #2a4c6715, inset 0 1px 0 #ffffffb8;
}
.icon-box img { width: 56%; height: auto; }
.icon-box.mint { background: linear-gradient(140deg,#effaf0,#abd8cf); }
.icon-box.sky { background: linear-gradient(140deg,#f1fafd,#afdbee); }
.icon-box.lilac { background: linear-gradient(140deg,#f5f0f9,#d3c9ed); }
.icon-box.sand { background: linear-gradient(140deg,#fff8df,#f2dcb1); }
.tile .icon-box { width: clamp(49px, 7vw, 69px); height: clamp(49px, 7vw, 69px); border-radius: 20px; }
.tile[data-selected] .icon-box { box-shadow: 0 3px 8px #25587624, inset 0 1px 0 #fff; }

.step-button, .utility, .action {
  min-height: 39px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(var(--paper),var(--panel));
  box-shadow: 0 2px 1px #233d4b11, inset 0 1px 0 var(--rim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--blue);
  font-weight: 720;
}
.step-button { width: 44px; height: 57px; }
.step-button img { width: 20px; }
.step-button:hover:not(:disabled), .action:hover, .utility:hover, .user-button:hover { border-color: var(--accent); }
.pagination { display: flex; justify-content: center; align-items: center; gap: 2px; margin-block: 6px 7px; }
.page-dot { width: 26px; height: 23px; padding: 0; display: grid; place-items: center; border: 0; background: transparent; }
.page-dot::before { content: ""; width: 8px; height: 8px; border-radius: 20px; background: #9fbdc9; transition: width .18s ease; }
.page-dot[aria-current]::before { width: 20px; background: var(--accent); }
.launch-detail, .settings-preview {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  min-height: 70px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 9px 12px;
  box-shadow: 0 2px 4px #253d5209;
}
.detail-copy, .settings-preview > div { flex: 1; min-width: 0; }
.detail-copy strong { font-size: 16px; }
.detail-copy p, .settings-preview p, .page-head p, .settings-head p { margin-top: 3px; color: var(--muted); font-size: 13px; }
.detail-icon .icon-box { width: 43px; height: 43px; border-radius: 12px; }
.action { min-width: 68px; padding: 6px 12px; font-size: 13px; text-decoration: none; }
.action.primary {
  background: linear-gradient(#228599,#195d75);
  color: white;
  border-color: #286a80;
  box-shadow: inset 0 1px 0 #ffffff66, 0 2px 1px #23485533;
}
.action.danger { color: #9a393e; border-color: #de9fa6; }

.control-bar { position: sticky; z-index: 2; bottom: 0; display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; min-height: 75px; background: var(--chrome); border-radius: 0 0 34px 34px; }
.control-bar > [data-action="back"] { justify-self: start; }
.utilities { display: flex; gap: 8px; justify-content: end; }
.utility { padding: 6px 9px; min-width: 39px; white-space: nowrap; font-size: 13px; }
.utility img { width: 18px; }
.home-key {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 15px;
  min-height: 41px;
  border: 1px solid #345d74;
  border-radius: 50px;
  background: linear-gradient(#4d758a,#27475f);
  color: white;
  font-size: 13px;
  font-weight: 780;
  letter-spacing: .07em;
  box-shadow: 0 2px 3px #21364755, inset 0 1px 0 #ffffff55;
}
.home-key img { width: 17px; }
.home-key:hover { background: linear-gradient(#5d879d,#345871); }

.page-head { display: flex; align-items: center; gap: 13px; margin: 8px 0 16px; }
.page-head h1 { font-size: clamp(24px,3.6vw,34px); }
.settings-layout { min-width: 0; }
.category-carousel { margin-bottom: 14px; }
.category-list {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(5,minmax(0,1fr));
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--well);
  box-shadow: inset 0 1px 3px #25445511;
}
.category {
  min-width: 0;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  gap: 5px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 3px;
  font-size: 12px;
  font-weight: 690;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.category .icon-box { width: 34px; height: 34px; border-radius: 9px; }
.category:hover { border-color: var(--accent); }
.category[aria-current] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.settings-preview { min-height: 110px; padding: 14px 18px; }
.settings-preview .icon-box { width: 60px; height: 60px; border-radius: 16px; }
.settings-content, .guide {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 17px;
  overflow: hidden;
}
.settings-head { display: flex; align-items: center; gap: 12px; padding: 13px 17px; border-bottom: 1px solid var(--line); background: var(--panel); }
.settings-body { padding: 0 17px 5px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; min-width: 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border: 0; }
.setting-row p { font-size: 12px; color: var(--muted); margin-top: 3px; }
.row-title { font-weight: 700; font-size: 14px; }
.setting-control { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.setting-control input[type=range] { width: clamp(69px, 17vw, 150px); accent-color: var(--accent); }
.setting-control input[type=checkbox] { width: 21px; height: 21px; accent-color: var(--accent); }
.setting-control select, .setting-control input[type=text], .setting-control input[type=url], .setting-control input[type=datetime-local] {
  max-width: 100%;
  padding: 6px 8px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  font-size: 14px;
}
.setting-control output { min-width: 40px; text-align: right; font-size: 13px; color: var(--blue); }
.preview { margin-top: 12px; padding: 10px; border-radius: 12px; background: var(--panel); }
.preview-display {
  position: relative;
  display: grid;
  place-items: center;
  max-width: 100%;
  width: 235px;
  margin-inline: auto;
  border: 4px solid #3a6684;
  border-radius: 9px;
  color: #244a60;
  font-size: 13px;
  font-weight: 750;
  background: repeating-linear-gradient(0deg,#d3ebf8,#d3ebf8 10px,#e8f5f9 10px,#e8f5f9 20px);
}
.preview-display::after { content: ""; position: absolute; inset: var(--safe,5%); border: 1px dashed #46688f; border-radius: 4px; }
.file-name { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; max-width: 170px; }
.guide { padding: 16px; }
.guide + .guide { margin-top: 12px; }
.guide h2 { margin-bottom: 8px; }
.guide p { color: var(--muted); font-size: 14px; }
.guide .action { margin-top: 8px; }
.guide table { border-collapse: collapse; width: 100%; font-size: 14px; }
.guide td, .guide th { padding: 8px 5px; text-align: left; border-bottom: 1px solid var(--line); }
.guide tr:last-child td, .guide tr:last-child th { border-bottom: 0; }
.dialog-layer { position: fixed; inset: 0; z-index: 4; display: grid; place-items: center; padding: 14px; background: #193344ad; }
.dialog { max-height: 90vh; overflow: auto; width: min(100%,500px); border-radius: 21px; padding: 17px; border: 1px solid var(--line); background: var(--paper); box-shadow: 0 14px 65px #102d40a0; }
.dialog p { margin: 7px 0 16px; font-size: 14px; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; }
.quick-menu { width: min(100%,585px); }
.quick-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.quick-menu nav { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
.quick-menu nav button { min-width: 0; display: grid; justify-items: center; gap: 7px; padding: 11px 2px; border-radius: 13px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; font-weight: 700; }
.quick-menu nav button:hover { border-color: var(--accent); }
.toast { position: fixed; z-index: 6; right: 18px; bottom: 14px; max-width: calc(100% - 36px); border-radius: 13px; padding: 10px 14px; background: #23475e; color: #fff; box-shadow: 0 4px 18px #1e384955; font-size: 13px; }

[data-theme=dark] {
  color-scheme: dark;
  --ink: #edf7fc;
  --muted: #bed1df;
  --blue: #b1e5f4;
  --accent: #69bfd8;
  --line: #4c7084;
  --paper: #213d4e;
  --panel: #1a3345;
  --well: #142c3f;
  --rim: #ffffff29;
  --chrome: #20394a;
  --backdrop: #182f40;
}
[data-theme=dark] body { background: radial-gradient(ellipse at 72% 0,#2e5365,var(--backdrop) 72%); }
[data-theme=dark] .shell { border-color: var(--line); }
[data-theme=dark] .utility img, [data-theme=dark] .step-button img, [data-theme=dark] .breadcrumb img { filter: brightness(2.25); }
[data-theme=dark] .action.danger { color: #ffd9da; }
[data-theme=dark] .tile[data-selected] { border-color: var(--accent); }
@keyframes screen-in { from { opacity: .8; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  [data-motion=on] .screen > *, [data-motion=on] .dialog { animation: screen-in .17s ease-out both; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
[data-motion=off] *, [data-motion=off] *::before, [data-motion=off] *::after { transition: none !important; }
@media (max-width: 660px) {
  .shell { width: calc(100% - 18px); margin: 9px auto; border-radius: 24px; }
  main { margin-inline: 6px; padding-inline: 10px; border-radius: 19px; }
  .console-header, .control-bar { min-height: 60px; padding-inline: 12px; }
  .control-bar { border-radius: 0 0 24px 24px; }
  .brand { gap: 7px; font-size: 18px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 11px; }
  .brand-mark img { width: 20px; }
  .brand-sub { margin-left: 5px; font-size: 10px; }
  .console-status { gap: 8px; }
  .system-status { font-size: 10px; }
  .user-button { padding: 3px 6px 3px 4px; }
  .user-button span { max-width: 72px; }
  .launcher-head { margin-block: 4px 12px; }
  .launcher-board, .category-carousel { grid-template-columns: 29px minmax(0,1fr) 29px; gap: 4px; }
  .step-button { width: 29px; height: 43px; min-height: 43px; border-radius: 9px; }
  .step-button img { width: 16px; }
  .tiles { border-radius: 15px; }
  .tile, .tile-slot { min-height: 83px; border-radius: 12px; }
  .tile { gap: 6px; padding: 7px 2px; }
  .tile .icon-box { width: 37px; height: 37px; border-radius: 12px; }
  .launch-detail, .settings-preview { gap: 7px; padding: 7px 8px; }
  .detail-copy strong { font-size: 14px; }
  .detail-copy p, .settings-preview p { font-size: 11px; }
  .category-list { gap: 4px; padding: 4px; border-radius: 12px; }
  .category { min-height: 66px; font-size: 10px; border-radius: 8px; }
  .category .icon-box { width: 26px; height: 26px; border-radius: 8px; }
  .settings-head, .settings-body { padding-inline: 10px; }
  .setting-row { flex-wrap: wrap; }
  .setting-control { justify-content: flex-start; }
}
@media (max-width: 395px) {
  .system-status span { display: none; }
  .clock-face { display: none; }
  .clock-card { padding: 5px 8px; }
  h1 { font-size: 21px; }
  .tiles { gap: 5px; padding: 6px; }
  .tile-title { font-size: 10px; }
  .tile .icon-box { width: 31px; height: 31px; border-radius: 9px; }
  .tile, .tile-slot { min-height: 66px; }
  .category .icon-box { width: 23px; height: 23px; }
  .detail-icon { display: none; }
  .control-bar > .utility span { display: none; }
  .guide table { font-size: 12px; }
}
@media (max-width: 340px) {
  .brand-sub { display: none; }
}
@media (max-height: 550px) and (min-width: 661px) {
  .shell { margin-block: 9px; }
  .console-header, .control-bar { min-height: 55px; }
  .launcher-head { margin-block: 0 9px; }
  .tile, .tile-slot { min-height: 87px; }
  .tile { gap: 5px; padding: 6px 3px; }
  .tile .icon-box { width: 45px; height: 45px; border-radius: 12px; }
  .launch-detail { min-height: 55px; }
}
