﻿:root {
  --bg-color: #f4f4f4;
  --text-color: #333;
  --card-bg: #ffffff;
  --primary-color: #ffc107;
  --chip-bg: #f0f0f0;
  --chip-text: #555;
  --nav-bg: #ffffff;
  --border-color: #eee;
}
body.dark {
  --bg-color: #121212;
  --text-color: #e0e0e0;
  --card-bg: #1e1e1e;
  --chip-bg: #333;
  --chip-text: #ccc;
  --nav-bg: #1e1e1e;
  --border-color: #333;
}
body { margin: 0; font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg-color); color: var(--text-color); overflow: hidden; transition: background 0.3s, color 0.3s; }
html, body { touch-action: manipulation; }
@media (max-width: 768px) { body * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; } }
.top-container { position: fixed; top: 0; width: 100%; background: var(--nav-bg); z-index: 100; box-shadow: 0 2px 4px rgba(0,0,0,0.05); transition: background 0.3s; }
.navbar { padding: 1rem 1rem 0.5rem 1rem; text-align: center; }
#app-title { margin: 0; font-size: 1.2rem; color: var(--primary-color); font-weight: bold; text-transform: uppercase; }
.category-bar { display: flex; overflow-x: auto; padding: 0.5rem 1rem 1rem 1rem; gap: 0.5rem; -ms-overflow-style: none; scrollbar-width: none; margin-bottom: -0.4rem;}
.category-bar::-webkit-scrollbar { display: none; }
.category-chip { background: var(--chip-bg); color: var(--chip-text); padding: 0.5rem 1rem; border-radius: 20px; font-size: 0.9rem; white-space: nowrap; cursor: pointer; transition: all 0.2s ease; font-weight: 500; }
.category-chip.active { background: var(--primary-color); color: #000; }
#app { padding: 7rem 1rem 6rem 1rem; height: 100vh; box-sizing: border-box; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.link-card, .settings-card { background: var(--card-bg); padding: 1rem; border-radius: 12px; margin-bottom: 1rem; box-shadow: 0 1px 3px rgba(0,0,0,0.05); transition: background 0.3s; }
.link-card { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.settings-card h2 { margin-top: 0; font-size: 1.1rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
.action-btn { background: var(--primary-color); color: #000; border: none; padding: 0.75rem 1rem; border-radius: 8px; font-weight: bold; cursor: pointer; width: 100%; font-size: 1rem; margin-top: 0.5rem; }
.link-card-info { display: flex; flex-direction: column; overflow: hidden; }
.link-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; color: var(--text-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-url { font-size: 0.8rem; color: #777; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-delete { background: #ff4d4f; color: white; border: none; border-radius: 8px; padding: 0.5rem; cursor: pointer; margin-left: 1rem; }
#newItem { position: fixed; bottom: 5rem; right: 1rem; border: none; border-radius: 50%; width: 60px; height: 60px; font-size: 28px; background: var(--primary-color); color: #000; box-shadow: 0 4px 10px rgba(0,0,0,0.2); cursor: pointer; transition: transform 0.2s; z-index: 10; }
#newItem:active { transform: scale(0.95); }
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal.hidden, .hidden { display: none !important; }
.modal-content { background: var(--card-bg); color: var(--text-color); padding: 1.5rem; border-radius: 16px; width: 80%; max-width: 400px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); transition: background 0.3s; }
.modal-content h2 { margin-top: 0; margin-bottom: 1rem; font-size: 1.2rem; text-align: center; }
.modal-content input { width: 100%; padding: 0.75rem; margin-bottom: 1rem; border: 1px solid var(--border-color); border-radius: 8px; box-sizing: border-box; font-size: 1rem; background: var(--bg-color); color: var(--text-color); }
.modal-actions { display: flex; justify-content: space-between; gap: 1rem; }
.modal-actions button { flex: 1; padding: 0.75rem; border: none; border-radius: 8px; font-size: 1rem; font-weight: bold; cursor: pointer; }
#cancelLinkBtn { background: var(--chip-bg); color: var(--chip-text); }
#saveLinkBtn { background: var(--primary-color); color: #000; }
.tabbar { position: fixed; bottom: 0; width: 100%; display: flex; background: var(--nav-bg); border-top: 1px solid var(--border-color); z-index: 100; transition: background 0.3s; padding-bottom: env(safe-area-inset-bottom); }
.tabbar .tab { flex: 1; text-align: center; padding: 0.75rem 0; cursor: pointer; color: var(--chip-text); font-size: 0.9rem; transition: color 0.2s; }
.tabbar .tab.active { color: var(--primary-color); font-weight: bold; }
input { flex: 1; padding: 0.75rem; margin-bottom: 1rem; border: 1px solid var(--border-color); border-radius: 8px; box-sizing: border-box; font-size: 1rem; background: var(--bg-color); color: var(--text-color); }