* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', sans-serif; background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); min-height: 100vh; color: #eee; }

/* Navbar */
.navbar { background: rgba(0,0,0,0.3); padding: 1rem 2rem; display: flex; gap: 2rem; border-bottom: 1px solid #333; }
.navbar a { color: #888; text-decoration: none; font-size: 1.1rem; padding: 0.5rem 1rem; border-radius: 5px; }
.navbar a:hover, .navbar a.active { color: #fff; background: rgba(255,255,255,0.1); }

/* Layout */
.container { max-width: 1400px; margin: 2rem auto; padding: 0 1rem; }

/* Card */
.card { background: rgba(255,255,255,0.05); border-radius: 10px; padding: 2rem; margin-bottom: 2rem; border: 1px solid #333; }
.card h2 { margin-bottom: 1.5rem; color: #7eb8da; }

/* Form */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; color: #aaa; }
.form-group input, .form-group textarea { width: 100%; padding: 0.75rem; border: 1px solid #444; border-radius: 5px; background: rgba(0,0,0,0.3); color: #fff; font-size: 1rem; }
.form-group textarea { height: 120px; resize: vertical; }
.form-group input[type="number"] { width: 120px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Buttons */
.btn { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; padding: 0.8rem 1.5rem; font-size: 1rem; border-radius: 5px; cursor: pointer; margin-right: 0.5rem; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 20px rgba(102,126,234,0.4); }
.btn-secondary { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.btn-success { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.btn-group { display: flex; gap: 1rem; margin-top: 1rem; }

/* Table */
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td { padding: 0.75rem; text-align: center; border-bottom: 1px solid #333; }
th { background: rgba(0,0,0,0.3); color: #7eb8da; font-weight: 600; }
tr:hover { background: rgba(255,255,255,0.05); }

/* Status colors */
.pass { color: #4ade80; font-weight: bold; }
.fail { color: #f87171; font-weight: bold; }
.win { color: #4ade80; font-weight: bold; }
.lose { color: #f87171; }

/* Error */
.error { background: rgba(248,113,113,0.2); border: 1px solid #f87171; padding: 1rem; border-radius: 5px; margin-bottom: 1rem; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2rem; }
.stats-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: rgba(0,0,0,0.3); padding: 1.5rem; border-radius: 8px; text-align: center; }
.stat-card .value { font-size: 2rem; font-weight: bold; color: #7eb8da; }
.stat-card .value.pass { color: #4ade80; }
.stat-card .value.fail { color: #f87171; }
.stat-card .label { color: #888; margin-top: 0.5rem; }

/* User Profile */
.profile-header { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid #333; }
.profile-avatar { width: 80px; height: 80px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.profile-name { font-size: 1.8rem; font-weight: bold; }
.profile-name .nickname { color: #fff; }
.profile-name .level { color: #888; font-size: 1rem; margin-left: 0.5rem; }
.profile-intro { color: #888; font-size: 0.95rem; margin-top: 0.3rem; }
.profile-guild { display: inline-block; padding: 0.3rem 0.8rem; border-radius: 20px; font-size: 0.85rem; margin-top: 0.5rem; }
.profile-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.profile-stat { background: rgba(0,0,0,0.3); padding: 1.2rem; border-radius: 10px; text-align: center; }
.profile-stat .value { font-size: 1.5rem; font-weight: bold; }
.profile-stat .value.win { color: #4ade80; }
.profile-stat .value.lose { color: #f87171; }
.profile-stat .value.fame { color: #fbbf24; }
.profile-stat .value.rank { color: #a78bfa; }
.profile-stat .value.rate { color: #38bdf8; }
.profile-stat .label { color: #888; font-size: 0.85rem; margin-top: 0.3rem; }
.profile-details { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.profile-detail { background: rgba(0,0,0,0.2); padding: 1rem; border-radius: 8px; }
.profile-detail .label { color: #888; font-size: 0.8rem; margin-bottom: 0.3rem; }
.profile-detail .value { color: #fff; font-size: 0.95rem; }
.profile-actions { display: flex; gap: 1rem; padding-top: 1rem; border-top: 1px solid #333; }

/* Count Card */
.count-card { background: linear-gradient(135deg, rgba(74,222,128,0.1) 0%, rgba(56,189,248,0.1) 100%); border: 1px solid rgba(74,222,128,0.3); }
.count-card h2 { color: #4ade80; }
.count-display { font-size: 4rem; font-weight: bold; color: #4ade80; text-align: center; padding: 2rem; }
.count-info { text-align: center; color: #888; margin-bottom: 1rem; }

/* Dice Calculator */
.radio-group { display: flex; gap: 1.5rem; margin: 0.5rem 0; flex-wrap: wrap; }
.radio-group label { display: flex; align-items: center; gap: 0.5rem; color: #eee; cursor: pointer; }
input[type="radio"] { accent-color: #667eea; }
.info-box { background: rgba(240,192,64,0.1); border: 1px solid #f0c040; border-radius: 5px; padding: 1rem; margin-bottom: 1.5rem; font-size: 0.9rem; color: #f0c040; }
.result-box { background: linear-gradient(135deg, rgba(102,126,234,0.2) 0%, rgba(118,75,162,0.2) 100%); border: 2px solid #667eea; border-radius: 10px; padding: 2rem; text-align: center; margin-top: 1.5rem; }
.result-box .probability { font-size: 3.5rem; font-weight: bold; color: #667eea; }
.result-box .detail { margin-top: 1rem; color: #aaa; font-size: 0.95rem; }
.result-box .detail div { margin: 0.5rem 0; }
.input-row { display: flex; gap: 1rem; align-items: end; flex-wrap: wrap; }
.input-row .form-group { flex: 0 0 auto; }

.navbar-admin { margin-left: auto; }

/* Tab Buttons (preset selectors) */
.tab-btn { background: rgba(255,255,255,0.05); color: #888; border: 1px solid #444; padding: 0.5rem 1rem; font-size: 0.95rem; border-radius: 5px; cursor: pointer; transition: all 0.15s; }
.tab-btn:hover { color: #fff; border-color: #7eb8da; }
.tab-btn.active { background: rgba(126,184,218,0.15); color: #7eb8da; border-color: #7eb8da; font-weight: bold; }

/* Mail Calculator */
.mail-input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.mail-input-box { background: rgba(0,0,0,0.25); border: 1px solid #3a4a5a; border-radius: 10px; padding: 1.2rem 1rem; text-align: center; }
.mail-input-label { font-size: 0.82rem; color: #888; margin-bottom: 0.6rem; letter-spacing: 0.03em; }
.mail-input-inner { display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.mail-input-field { background: transparent; border: none; border-bottom: 2px solid #4a5a6a; color: #fff; font-size: 1.8rem; font-weight: bold; width: 120px; text-align: center; outline: none; padding: 0.2rem 0; }
.mail-input-field:focus { border-bottom-color: #7eb8da; }
.mail-input-unit { font-size: 1rem; color: #7eb8da; font-weight: 600; }
.mail-target-section { border-top: 1px solid #2a3a4a; padding-top: 1.25rem; }
.mail-target-header { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 0.75rem; }
.mail-target-label { font-size: 0.9rem; color: #aaa; font-weight: 600; }
.mail-target-hint { font-size: 0.75rem; color: #5a8a9a; }
.mail-preset-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.mail-preset-btn { background: rgba(255,255,255,0.04); border: 1px solid #3a4a5a; border-radius: 8px; padding: 0.75rem 0.5rem; cursor: pointer; transition: all 0.15s; display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.mail-preset-btn:hover { border-color: #7eb8da; background: rgba(126,184,218,0.07); }
.mail-preset-btn.active { border-color: #7eb8da; background: rgba(126,184,218,0.15); }
.mail-preset-btn .preset-name { font-size: 0.95rem; color: #ccc; font-weight: 600; }
.mail-preset-btn .preset-slots { font-size: 0.78rem; color: #666; }
.mail-preset-btn.active .preset-name { color: #7eb8da; }
.mail-preset-btn.active .preset-slots { color: #5a8a9a; }
.mail-custom-input { width: 100%; background: rgba(0,0,0,0.3); border: 1px solid #3a4a5a; border-radius: 6px; color: #fff; font-size: 1.1rem; padding: 0.6rem 0.8rem; outline: none; }
.mail-custom-input:focus { border-color: #7eb8da; }

/* Box Calculator */
.box-input-tabs { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.box-url-row { display: flex; gap: 0.5rem; }
.box-url-input { flex: 1; padding: 0.7rem 0.9rem; border: 1px solid #444; border-radius: 5px; background: rgba(0,0,0,0.3); color: #fff; font-size: 0.95rem; outline: none; }
.box-url-input:focus { border-color: #7eb8da; }
.box-url-hint { margin-top: 0.5rem; font-size: 0.78rem; color: #555; }
.box-url-hint code { color: #7eb8da; font-family: monospace; }
.box-json-input { width: 100%; height: 160px; padding: 0.75rem; border: 1px solid #444; border-radius: 5px; background: rgba(0,0,0,0.3); color: #fff; font-size: 0.88rem; font-family: monospace; resize: vertical; outline: none; }
.box-json-input:focus { border-color: #7eb8da; }
.box-event-header { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1rem; }
.box-event-sub { color: #555; font-size: 0.85rem; }
.box-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; }
.box-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.box-table th, .box-table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid #2a3a4a; text-align: center; }
.box-table th { background: rgba(0,0,0,0.3); color: #7eb8da; font-weight: 600; font-size: 0.88rem; }
.box-table tr:hover { background: rgba(255,255,255,0.03); }
.box-item-name { text-align: left !important; }
.box-excl-badge { color: #f0c040; font-size: 0.7rem; margin-right: 0.3rem; vertical-align: middle; }
.box-owned-col { width: 60px; }
.box-checkbox { width: 16px; height: 16px; cursor: pointer; accent-color: #7eb8da; }
.box-row-owned { opacity: 0.4; }
.box-prob-zero { color: #444; }
.box-prob-up { color: #4ade80; font-weight: bold; }
.box-total-note { text-align: right; font-size: 0.78rem; color: #555; margin-top: 0.5rem; }
.box-equip-summary { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.box-equip-prob { font-size: 0.9rem; color: #aaa; }
.box-equip-prob strong { color: #7eb8da; font-size: 1.1rem; }
.box-check-all { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; font-size: 0.88rem; color: #888; user-select: none; }
.box-check-all input { cursor: pointer; accent-color: #7eb8da; width: 15px; height: 15px; }

/* Admin */
.rank-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.rank-table th, .rank-table td { padding: 0.6rem 0.5rem; text-align: center; border-bottom: 1px solid #333; }
.rank-table th { background: rgba(0,0,0,0.3); color: #7eb8da; }
.nick-col { text-align: left !important; min-width: 100px; }
.day-win { color: #4ade80; font-weight: bold; }
.day-lose { color: #f87171; }
.day-none { color: #555; }
.cond-ok { color: #4ade80; font-weight: bold; }
.cond-fail { color: #555; }
