:root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  color-scheme: dark;
  --bg: #111114;
  --surface: #1c1c20;
  --field: #29292e;
  --hover: #34343a;
  --text: #f5f5f7;
  --secondary: #a1a1aa;
  --line: #ffffff14;
  --accent: #409cff;
  --accent-soft: #409cff20;
  --focus: #409cff55;
  --danger: #ff6961;
  --header: #1c1c20cc;
  --shadow: 0 4px 16px #00000020;
  --cols: 6;
  --tile: 88px;
  --gap-x: 28px;
  --gap-y: 25px;
  --radius: 23px;
  --card-width: 124px;
  color: var(--text);
  background: var(--bg);
}
:root[data-theme=light] {
  color-scheme: light;
  --bg: #f2f2f7;
  --surface: #ffffff;
  --field: #e9e9ef;
  --hover: #dedee6;
  --text: #1d1d1f;
  --secondary: #686873;
  --line: #00000012;
  --accent: #007aff;
  --accent-soft: #007aff12;
  --focus: #007aff40;
  --danger: #d92d25;
  --header: #ffffffcc;
  --shadow: 0 4px 16px #20204008;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; border: 1px solid transparent; border-radius: 12px; background: var(--field); color: var(--text); padding: 10px 15px; font-size: 13px; font-weight: 500; transition: background .16s, box-shadow .16s; }
button:hover { background: var(--hover); }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
button:disabled { opacity: .5; cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
input::placeholder { color: var(--secondary); opacity: 1; }
header { padding: 18px 36px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); background: var(--header); backdrop-filter: blur(20px); }
.brand-area, .brand, .toolbar { display: flex; align-items: center; }
.brand-area { min-width: 0; }
.brand { gap: 10px; font-size: 21px; font-weight: 700; letter-spacing: -.6px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--accent); color: #fff; font-size: 26px; font-weight: 750; }
.toolbar { gap: 8px; }
.toolbar button { min-height: 40px; }
.local-badge { font-size: 11px; color: var(--secondary); margin-right: 10px; }
.theme-toggle { width: 40px; padding: 5px; font-size: 21px; }
#edit[aria-pressed=true] { color: var(--accent); background: var(--accent-soft); }
main { max-width: 1300px; margin: auto; padding: 0 36px; }
.hero { text-align: center; padding: 28px 0 32px; }
.eyebrow { font-size: 12px; font-weight: 500; letter-spacing: .5px; color: var(--secondary); }
.hero .eyebrow { margin-bottom: 18px; }
.searches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 830px; margin: auto; }
.search { display: flex; align-items: center; gap: 12px; height: 58px; padding: 8px 10px 8px 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); transition: border-color .16s, box-shadow .16s; }
.search > span { width: 24px; flex: 0 0 24px; font-size: 24px; font-weight: 750; }
.google { color: #4285f4; }.naver { color: #03c75a; }.youtube { color: #ff453a; }.coupang { color: #f39b32; }
.search input, .bookmark-search input { flex: 1; display: block; min-width: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; outline: none; box-shadow: none; background: transparent; color: var(--text); font-size: 14px; }
.search input:focus-visible, .bookmark-search input:focus-visible { outline: none; }
.search:focus-within, .bookmark-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.search button { flex: 0 0 36px; width: 36px; height: 36px; padding: 0; border-radius: 11px; background: var(--field); color: var(--secondary); font-size: 21px; }
.search button:hover { color: var(--accent); background: var(--accent-soft); }
.search .search-handle { flex: 0 0 24px; width: 24px; background: transparent; color: var(--accent); cursor: grab; font-size: 24px; touch-action: manipulation; }
.searches.editing .search { border-style: dashed; border-color: var(--secondary); cursor: grab; }
.searches.editing .search input { cursor: grab; }
.searches .search.search-dragging { opacity: .5; }
.searches .search.search-drop { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--focus); }
.section-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 4px; border-radius: 15px; background: var(--field); }
nav button { padding: 9px 14px; border-radius: 11px; background: transparent; color: var(--secondary); white-space: nowrap; }
nav button.active { color: var(--text); background: var(--surface); box-shadow: 0 2px 6px #00000012; }
nav small { margin-left: 6px; font-size: 10px; opacity: .7; }
nav button.category-add-tab { min-width: 38px; padding: 5px 10px; font-size: 22px; line-height: 28px; color: var(--accent); }
#category-editor { max-width: 420px; }
.category-tab-group { display: inline-flex; align-items: center; gap: 2px; border: 1px dashed var(--secondary); border-radius: 12px; padding-right: 4px; }
nav button.category-tab-action { width: 28px; min-height: 32px; padding: 4px; font-size: 17px; }
nav button.category-tab-action:hover { background: var(--surface); }
nav button.category-tab-action:disabled { opacity: .35; cursor: not-allowed; }
.section-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; min-width: 0; }
.section-actions .quick-new-tab { flex: 0 0 auto; gap: 8px; padding: 10px 4px; white-space: nowrap; }
.bookmark-search { display: flex; align-items: center; gap: 9px; width: 250px; min-width: 0; height: 44px; margin: 0; padding: 0 12px; border: 1px solid transparent; border-radius: 13px; background: var(--field); color: var(--secondary); transition: border-color .16s, box-shadow .16s; }
.bookmark-search > span { font-size: 22px; line-height: 1; flex: 0 0 18px; }
.bookmark-search input { font-size: 13px; }
.bookmark-search input::-webkit-search-cancel-button { display: none; }
.bookmark-search button { flex: 0 0 22px; width: 22px; height: 22px; padding: 0; border-radius: 50%; font-size: 18px; line-height: 18px; background: var(--hover); color: var(--secondary); }
.accent { background: var(--accent); color: #fff; font-weight: 600; }
.accent:hover { background: var(--accent); filter: brightness(1.08); }
#add { height: 44px; white-space: nowrap; }
.grid-meta { display: flex; justify-content: space-between; gap: 16px; margin: 20px 0; color: var(--secondary); font-size: 11px; line-height: 1.6; }
#section-label { color: var(--secondary); flex-shrink: 0; }
#hint { text-align: right; }
.grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, var(--card-width))); column-gap: var(--gap-x); row-gap: var(--gap-y); justify-content: center; min-height: 270px; align-content: start; }
.tile { position: relative; min-width: 0; text-align: center; padding: 8px 0; border-radius: 18px; border: 1px solid transparent; user-select: none; }
.tile:hover { background: var(--accent-soft); }
.tile a { display: flex; flex-direction: column; align-items: center; gap: 12px; border-radius: 16px; }
.icon { display: flex; align-items: center; justify-content: center; width: var(--tile); height: var(--tile); max-width: 100%; border-radius: var(--radius); overflow: hidden; box-shadow: 0 4px 12px #00000014, inset 0 0 0 1px #ffffff0a; transition: transform .16s; }
.tile:hover .icon { transform: translateY(-3px); }
.icon img { width: 52%; height: 52%; object-fit: contain; }
.icon.custom img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.icon.custom.square-image img { object-fit: cover; padding: 0; }
.icon.transparent { background: transparent !important; box-shadow: none; }
.icon.transparent .fallback { color: var(--accent); }
.fallback { font-size: 32px; font-weight: 700; color: #fff; }
.tile-title { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 12px; line-height: 1.5; }
.tile-edit { position: absolute; top: 0; right: 2px; display: none; padding: 5px 9px; border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); color: var(--accent); }
.editing .tile-edit { display: block; }
.editing .tile, nav.editing button { cursor: grab; border: 1px dashed var(--secondary); }
nav.editing button:active { cursor: grabbing; }
.add-tile { display: flex; flex-direction: column; align-items: center; gap: 12px; background: transparent; padding: 8px 0; color: var(--secondary); font-size: 12px; }
.add-tile:hover { background: var(--accent-soft); }
.add-tile .icon { background: var(--field); box-shadow: none; font-size: 30px; font-weight: 300; }
.pagination { display: flex; gap: 8px; justify-content: center; margin: 28px 0; }
.pagination:empty { margin: 0; }
.pagination button { min-width: 34px; border-radius: 10px; padding: 7px 10px; font-size: 12px; color: var(--secondary); }
.pagination .active { background: var(--accent); color: #fff; }
.drag-over, nav button.tab-drop, nav button.tab-reorder-over, .pagination .page-drop { background: var(--accent-soft) !important; outline: 2px solid var(--accent); outline-offset: 2px; color: var(--accent); }
.grid.link-drop { outline: 2px dashed var(--accent); outline-offset: 8px; border-radius: 16px; }
.tile.drop-before::before, .tile.drop-after::after { content: ''; position: absolute; top: 0; bottom: 0; width: 3px; background: var(--accent); border-radius: 3px; }
.tile.drop-before::before { left: -8px; }.tile.drop-after::after { right: -8px; }
footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 30px; padding: 22px 0; border-top: 1px solid var(--line); color: var(--secondary); font-size: 11px; }
footer b { font-weight: 600; color: var(--text); }
dialog { width: min(580px, calc(100% - 32px)); max-height: 90vh; padding: 28px; border: 1px solid var(--line); border-radius: 26px; background: var(--surface); color: var(--text); box-shadow: 0 24px 80px #00000040; scrollbar-width: thin; }
dialog::backdrop { background: #00000050; backdrop-filter: blur(8px); }
.dialog-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.dialog-title button { width: 34px; height: 34px; flex-shrink: 0; padding: 0; border-radius: 50%; color: var(--secondary); }
h2 { font-size: 23px; font-weight: 700; letter-spacing: -.6px; margin: 8px 0; }
h3 { font-size: 14px; margin: 20px 0 12px; }
dialog label { display: block; color: var(--secondary); font-size: 12px; font-weight: 500; margin: 18px 0; }
dialog label input:not([type=checkbox]):not([type=range]):not([type=color]), .category-controls > input { display: block; width: 100%; min-width: 0; margin-top: 8px; padding: 12px; border: 1px solid transparent; border-radius: 12px; background: var(--field); color: var(--text); font-size: 14px; }
dialog input:focus-visible { outline-offset: 1px; }
input[type=color] { display: block; width: 58px; height: 36px; margin-top: 8px; padding: 0; background: transparent; border: 0; cursor: pointer; }
input[type=range] { display: block; width: 100%; margin-top: 14px; accent-color: var(--accent); }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
.range-head { display: flex; justify-content: space-between; }.range-head output { color: var(--accent); }
.help, .icon-fetch span { font-size: 12px; line-height: 1.7; color: var(--secondary); }
.icon-fetch { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.icon-fetch button { flex-shrink: 0; padding: 9px 12px; font-size: 12px; color: var(--accent); }
.check, dialog label.check { display: flex; align-items: center; gap: 8px; }
.tile-style-controls { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: end; margin: 20px 0; }
.tile-style-controls label { margin: 0; }
#pick-screen-color { min-height: 40px; padding: 9px; font-size: 12px; color: var(--accent); }
.tile-transparent-control { min-height: 40px; white-space: nowrap; }
dialog#editor.picking-color::backdrop { background: transparent; backdrop-filter: none; }
dialog#editor.picking-color { opacity: 0; pointer-events: none; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.dialog-actions button { min-height: 42px; }
.danger { color: var(--danger); }.dialog-actions .danger { margin-right: auto; }
.category-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.category-controls > input { flex: 1; width: auto; margin: 0; }
.category-controls button { font-size: 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.weather-control, .weather-toggle, .weather { display: flex; align-items: center; }
.weather-control { margin-left: 22px; gap: 10px; }
.weather-toggle { gap: 8px; padding: 6px 0; background: transparent; color: var(--secondary); font-size: 12px; }
.weather-toggle:hover { background: transparent; color: var(--text); }
.toggle-track { display: flex; align-items: center; width: 32px; height: 20px; padding: 2px; border-radius: 20px; background: var(--hover); transition: background .18s; }
.toggle-track span { width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0002; transition: transform .18s; }
.weather-toggle[aria-checked=true] .toggle-track { background: #34c759; }
.weather-toggle[aria-checked=true] .toggle-track span { transform: translateX(12px); }
.weather { gap: 6px; font-size: 12px; color: var(--secondary); white-space: nowrap; }.weather-icon { font-size: 18px; }.weather-temp { font-weight: 600; color: var(--text); }
#toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); display: none; z-index: 10; max-width: 90vw; padding: 13px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 8px 32px #0003; font-size: 13px; }
.empty { grid-column: 1 / -1; padding: 35px; text-align: center; color: var(--secondary); }
.member-account-link { display: inline-block; color: var(--accent); font-size: 12px; padding: 10px 0; }
.member-page .toolbar { flex-wrap: wrap; justify-content: flex-end; max-width: 100%; }
#login .member-account-link { display: block; text-align: center; margin-top: 12px; }
#login::backdrop { background: var(--bg); }
#login-error, .local-badge[data-status=error] { color: var(--danger); }
.local-badge[data-status=saving] { color: var(--accent); }
#migration { background: var(--field); border-color: var(--line); color: var(--secondary); }
@media (min-width: 1500px) { main { max-width: 1450px; } }
@media (max-width: 900px) { .section-actions { width: 100%; }.bookmark-search { flex: 1; width: auto; }.local-badge { display: none; } }
@media (max-width: 700px) {
  header { padding: 14px 18px; flex-wrap: wrap; gap: 12px; }
  main { padding: 0 18px; }.toolbar { gap: 5px; }.toolbar button { font-size: 12px; padding: 8px 10px; }.toolbar .theme-toggle { font-size: 20px; }
  .weather-control { margin-left: 12px; }.weather-toggle > span:first-child, .weather-place { display: none; }
  .hero { padding: 22px 0 26px; }.search { height: 52px; padding-left: 12px; gap: 8px; }.search input { font-size: 13px; }
  .grid { column-gap: min(var(--gap-x), 16px); }nav button { padding: 9px 12px; }#hint { max-width: 55%; }
}
@media (max-width: 480px) {
  .brand { font-size: 18px; }.brand-mark { width: 32px; height: 32px; font-size: 23px; }
  .searches { grid-template-columns: 1fr; gap: 10px; }.search { border-radius: 15px; }
  .section-actions { gap: 8px; }#add { font-size: 12px; padding: 10px; }.bookmark-search { padding: 0 10px; }.bookmark-search input { font-size: 12px; }
  dialog { padding: 20px; }.icon-fetch { flex-wrap: wrap; }.tile-style-controls { gap: 8px; grid-template-columns: auto 1fr; }#pick-screen-color { grid-column: 1 / -1; grid-row: 2; }.tile-transparent-control { justify-self: end; }
}
@media (max-width: 1000px) {
  .section-actions { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; }
  .section-actions .bookmark-search { width: 100%; }
  #tabs { max-width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
  #tabs > * { flex-shrink: 0; }
  .grid { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); column-gap: var(--gap-x); }
  .tile a { min-height: calc(var(--tile) + 48px); }
  .tile-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
}
@media (max-width: 700px) {
  header { padding: 12px max(12px, env(safe-area-inset-left)); }
  main { padding: 0 max(12px, env(safe-area-inset-left)); }
  .toolbar, .member-page .toolbar { width: 100%; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding: 2px 0 5px; }
  .toolbar > * { flex-shrink: 0; white-space: nowrap; }
  .hero { padding: 16px 0 20px; }
  .hero .eyebrow { margin-bottom: 12px; }
  .section-bar { gap: 12px; padding-bottom: 14px; }
  #tabs { width: 100%; }
  #tabs button { min-height: 44px; }
  .section-actions { gap: 8px; }
  .section-actions .quick-new-tab { min-height: 44px; padding: 0; }
  .section-actions .quick-new-tab > span:first-child { display: none; }
  .section-actions #add { width: 44px; padding: 0; font-size: 0; }
  .section-actions #add::before { content: '+'; font-size: 26px; font-weight: 400; }
  .bookmark-search { height: 44px; padding: 0 10px; }
  .bookmark-search input, .search input, dialog label input:not([type=checkbox]):not([type=range]):not([type=color]) { font-size: 16px; }
  .bookmark-search input::placeholder { font-size: 12px; }
  .bookmark-search button { flex-basis: 32px; width: 32px; height: 36px; border-radius: 10px; background: transparent; }
  .grid-meta { margin: 14px 0; }
  .grid { min-height: 180px; }
  .pagination { flex-wrap: wrap; gap: 6px; }
  .pagination button { min-width: 44px; min-height: 44px; }
  .tile-edit { min-width: 36px; min-height: 36px; }
  dialog { max-height: calc(100dvh - 24px); }
  footer { flex-wrap: wrap; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; }.tile:hover .icon { transform: none; } }
#drag-status { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000; padding: 12px 20px; border-radius: 24px; background: #243247; color: #fff; box-shadow: 0 6px 24px #0003; pointer-events: none; font-size: 14px; white-space: nowrap; }
#drag-status[hidden] { display: none; }
.site-drag-preview { position: fixed; left: -10000px; top: 0; border: 2px solid var(--accent) !important; background: var(--surface); box-shadow: 0 8px 24px #0003; pointer-events: none; padding: 10px; }
.site-drag-preview .icon { transform: none !important; }
.site-size-controls { margin: 16px 0; padding: 14px; border: 1px solid var(--secondary); border-radius: 14px; }
.site-size-controls .site-size-default { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.site-size-controls input[type=checkbox] { width: auto; }
.site-size-controls input[type=range] { width: 100%; padding: 0; }
#image-preview img { outline: 1px solid var(--secondary); outline-offset: 2px; }
.drag-copy #drag-status { background: #087d3e; }
.drag-copy .tile, .drag-copy .tile *, .drag-copy #tabs button, .drag-copy #pagination button, .drag-copy #grid { cursor: copy !important; }
#mobile-settings-open { display: none; }
#mobile-menu { width: min(460px, calc(100% - 24px)); }
#mobile-menu .mobile-menu-display, #mobile-menu section > div { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
#mobile-menu .weather-toggle > span:first-child { display: inline; }
#mobile-menu .theme-toggle { width: auto; min-height: 44px; padding: 8px 12px; }
#mobile-menu .theme-toggle::after { content: ' 화면 테마'; font-size: 14px; }
#mobile-menu .mobile-layout-settings { width: 100%; margin-top: 16px; min-height: 44px; }
#mobile-menu .member-account-link { padding: 12px; background: var(--field); border-radius: 12px; }
#mobile-menu section { border-top: 1px solid var(--line); margin-top: 20px; }
#mobile-menu .mobile-menu-security button { color: var(--danger); min-height: 44px; }
@media (max-width: 700px) {
  header { flex-wrap: nowrap; gap: 8px; min-height: 64px; }
  .brand-area { flex: 1; }
  .weather-control { margin-left: 8px; }
  header .toolbar, .member-page header .toolbar { width: auto; flex-shrink: 0; overflow: visible; padding: 0; gap: 6px; }
  header #settings-open, header .local-badge { display: none; }
  #mobile-settings-open { display: block; width: 44px; height: 44px; font-size: 22px; padding: 0; }
  header #edit { min-height: 44px; }
  header .weather { gap: 3px; }
}
