* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  touch-action: manipulation;
}

body {
  background: #111;
  color: #eee;
  font-family: sans-serif;
  font-size: 16px;
  padding-bottom: 400px;
}

button,
input {
  font: inherit;
}

#tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 2px solid #333;
  scrollbar-width: none;
}

.tab {
  flex: 0 0 auto;
  min-width: 72px;
  padding: 12px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: bold;
  background: #1a1a1a;
  color: #666;
  cursor: pointer;
  user-select: none;
}

.tab.active {
  background: #222;
  color: #fff;
  border-bottom: 3px solid #f08;
}

#mode-help {
  padding: 5px 10px 6px;
  border-bottom: 1px solid #262626;
  background: #151515;
  color: #777;
  font-size: 11px;
  line-height: 1.2;
}

#author-bar {
  padding: 6px 10px;
  border-bottom: 1px solid #262626;
  background: #111;
}

#author-btn {
  display: inline-block;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid #333;
  border-radius: 999px;
  background: #1a1a1a;
  color: #aaa;
  font-size: 12px;
  line-height: 1.2;
}

#input-area {
  position: fixed;
  right: 0;
  bottom: 110px;
  left: 0;
  z-index: 10;
  padding: 12px;
  background: #1a1a1a;
  border-top: 2px solid #333;
  border-bottom: 2px solid #333;
}

#lamps {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
}

.lamp {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 2px solid #444;
  border-radius: 50%;
  background: #222;
  color: #555;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
}

.lamp.on {
  background: #e0193a;
  border-color: #ff4060;
  color: #fff;
  font-weight: bold;
}

#round-btns {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.rbtn {
  min-width: 50px;
  height: 44px;
  padding: 0 10px;
  border: 2px solid #444;
  border-radius: 6px;
  background: #1a1a1a;
  color: #aaa;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
}

.rbtn.selected {
  border-color: #f08;
  background: #3a1020;
  color: #fff;
}

#record-btn,
#record-uncertain-btn {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 12px;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
}

#record-btn {
  background: #c01030;
}

#record-btn:active {
  background: #900;
}

#record-uncertain-btn {
  border: 1px solid #6b5520;
  background: #2a2416;
  color: #e0bd66;
  font-size: 14px;
}

#record-uncertain-btn:active {
  background: #3a2d18;
}

#reset-btn {
  display: block;
  width: 100%;
  padding: 9px;
  border: none;
  border-radius: 8px;
  background: #333;
  color: #aaa;
  font-size: 14px;
  cursor: pointer;
}

#list-area {
  padding: 10px 12px;
}

#sync-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid #6b5520;
  border-radius: 8px;
  background: #211b12;
  color: #e0bd66;
  font-size: 13px;
  font-weight: bold;
}

#sync-warning[hidden] {
  display: none;
}

#sync-btn {
  min-width: 58px;
  padding: 6px 10px;
  border: 1px solid #8b7130;
  border-radius: 7px;
  background: #3a2d18;
  color: #f0d27a;
  font-size: 13px;
  font-weight: bold;
}

#sync-btn:disabled {
  opacity: 0.55;
}

#stats-panel,
#download-panel {
  margin-top: 14px;
  margin-bottom: 8px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #171717;
}

#stats-panel summary,
#download-panel summary {
  padding: 8px 10px;
  color: #888;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
}

#stats-panel[open] summary,
#download-panel[open] summary {
  color: #fff;
  border-bottom: 1px solid #333;
}

#prediction,
#stats,
#pattern-summary,
#download-help,
#download-actions {
  padding: 8px 10px;
  color: #aaa;
  font-size: 13px;
  line-height: 1.6;
}

#stats,
#pattern-summary,
#download-actions {
  border-top: 1px solid #262626;
}

#download-actions {
  display: flex;
  gap: 8px;
}

#download-actions button {
  flex: 1;
  padding: 9px 4px;
  border: none;
  border-radius: 8px;
  background: #1a2a4a;
  color: #aac;
  font-size: 14px;
  font-weight: bold;
}

.stat-row,
.pattern-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
}

.pattern-row span:first-child {
  color: #eee;
}

.pattern-group + .pattern-group {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #262626;
}

.pattern-title {
  margin-bottom: 2px;
  color: #f08;
  font-weight: bold;
}

.pattern-digits {
  letter-spacing: 0;
  font-weight: bold;
}

.author-group {
  margin-bottom: 10px;
}

.author-heading {
  margin: 8px 0 5px;
  padding: 3px 7px;
  border-left: 3px solid #f08;
  color: #aaa;
  font-size: 12px;
  font-weight: bold;
  line-height: 1.2;
}

.list-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #1a1a1a;
}

.row-lamps {
  display: flex;
  gap: 3px;
}

.rl {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: bold;
}

.rl.on {
  background: #e0193a;
  color: #fff;
}

.rl.off {
  border: 1px solid #333;
  background: #222;
  color: #444;
}

.row-side {
  min-width: 82px;
  margin-left: auto;
  text-align: right;
}

.row-result {
  color: #f08;
  font-size: 15px;
  font-weight: bold;
}

.row-result.outcome-continue {
  color: #27d36f;
}

.row-author {
  max-width: 72px;
  overflow: hidden;
  color: #777;
  font-size: 10px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uncertain-badge {
  min-width: 52px;
  padding: 3px 5px;
  border: 1px solid #6b5520;
  border-radius: 999px;
  background: #2a2416;
  color: #d8b35f;
  font-size: 10px;
  font-weight: bold;
  text-align: center;
}

.pending-badge {
  min-width: 46px;
  padding: 3px 5px;
  border: 1px solid #8b7130;
  border-radius: 999px;
  background: #211b12;
  color: #e0bd66;
  font-size: 10px;
  font-weight: bold;
  text-align: center;
}

.row-meta {
  max-width: 92px;
  color: #666;
  font-size: 9px;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
}

.delete-row {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: #2a1a1a;
  color: #c88;
  font-weight: bold;
}

#bottom-btns {
  display: flex;
  gap: 8px;
  padding: 10px 12px 20px;
}

.admin-only {
  display: none !important;
}

body.admin-mode .admin-only {
  display: flex !important;
}

#copy-btn,
#export-btn,
#import-label,
#clear-btn {
  flex: 1;
  padding: 10px 4px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
  cursor: pointer;
}

#copy-btn {
  background: #1a2a4a;
  color: #aac;
}

#export-btn,
#import-label {
  background: #1f2a1f;
  color: #9c9;
}

#import-label input {
  display: none;
}

#clear-btn {
  background: #2a1a1a;
  color: #c88;
}

#copy-msg {
  height: 20px;
  padding-bottom: 6px;
  color: #4c8;
  font-size: 13px;
  text-align: center;
}

.empty {
  padding: 20px;
  color: #444;
  font-size: 14px;
  text-align: center;
}
