:root {
  --bg: #fff6e7;
  --ink: #20242b;
  --muted: #6a6670;
  --line: #eadbc4;
  --paper: #fffdf8;
  --soft: #fff3cf;
  --blue: #326fbd;
  --green: #2f9465;
  --coral: #db5d4d;
  --gold: #f4b942;
  --dark: #263044;
  --warning: #c85c3c;
  --lavender: #eadfff;
  --shadow: 0 18px 42px rgba(93, 64, 35, .16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 246, 231, .94), rgba(245, 251, 255, .98)),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(38, 48, 68, .06) 32px 33px);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1260px, 100%);
  margin: 0 auto;
  padding: 26px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 253, 248, .96), rgba(255, 239, 205, .92) 46%, rgba(224, 244, 255, .92)),
    #fffdf8;
  box-shadow: var(--shadow);
  padding: 18px;
}

.keyboard-strip {
  display: grid;
  grid-template-columns: repeat(10, 18px);
  gap: 2px;
  height: 28px;
  margin-bottom: 10px;
  align-items: start;
}

.keyboard-strip span {
  display: block;
  height: 28px;
  border: 1px solid #9ca3aa;
  background: #fff;
  border-radius: 0 0 3px 3px;
}

.keyboard-strip .black {
  height: 18px;
  background: var(--dark);
  border-color: var(--dark);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(30px, 4vw, 46px);
  letter-spacing: 0;
  line-height: 1;
}

.date-line {
  margin-bottom: 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

.backup-status {
  flex-basis: 100%;
  min-height: 18px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.backup-status.error {
  color: var(--warning);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.button {
  border-radius: 8px;
  font-weight: 760;
  cursor: pointer;
  min-height: 42px;
  padding: 10px 14px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.primary-button {
  border: 0;
  background: #263044;
  color: white;
  box-shadow: 0 10px 22px rgba(38, 48, 68, .22);
}

.secondary-button {
  border: 1px solid #e4c887;
  background: #fff8df;
  color: #2f3542;
}

.ghost-button {
  border: 1px solid rgba(255, 255, 255, .45);
  background: transparent;
  color: white;
}

.small-button {
  min-height: 34px;
  padding: 7px 9px;
  margin-right: 6px;
  border: 1px solid #cfc7b9;
  background: white;
  color: #303940;
}

.danger-button {
  color: #aa342d;
}

.records-panel {
  grid-column: 2;
  grid-row: 2 / span 2;
}

.holiday-panel {
  grid-column: 1;
}

.score-panel {
  grid-column: 1;
}

.grid-layout {
  display: grid;
  grid-template-columns: 370px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.reward-card {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  background:
    linear-gradient(135deg, rgba(38, 48, 68, .98), rgba(50, 111, 189, .88)),
    var(--dark);
  color: white;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(38, 48, 68, .22);
  padding: 18px;
}

.reward-avatar {
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff5c9;
  border: 2px solid #ffd66e;
  box-shadow: inset 0 -8px 0 rgba(244, 185, 66, .25);
  font-size: 46px;
}

.reward-info h2 {
  margin-bottom: 4px;
  font-size: 22px;
  letter-spacing: 0;
}

.reward-label {
  margin-bottom: 3px;
  color: rgba(255, 255, 255, .74);
  font-size: 13px;
  font-weight: 760;
}

.reward-stars {
  margin-bottom: 10px;
  color: #ffe58a;
  font-weight: 800;
  font-size: 18px;
}

.reward-progress {
  width: min(420px, 100%);
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .22);
}

.reward-progress div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f7d457, #57d29a, #79c8ff);
}

.reward-next {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, .78);
  font-size: 13px;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  padding: 15px 16px;
  background: #263044;
  color: white;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.panel-header h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: 0;
}

.count-pill {
  background: rgba(255, 255, 255, .16);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
}

.panel-body {
  padding: 16px;
}

.empty-state {
  border: 1px dashed #d7b978;
  background: #fff8df;
  border-radius: 8px;
  padding: 18px;
  text-align: center;
}

.empty-state h3 {
  margin-bottom: 8px;
  font-size: 18px;
  letter-spacing: 0;
}

.empty-state p {
  margin-bottom: 0;
  color: #626b73;
  line-height: 1.45;
}

.due-list {
  display: grid;
  gap: 14px;
}

.practice-section {
  display: grid;
  gap: 10px;
}

.practice-section h3 {
  margin-bottom: 0;
  color: #263044;
  font-size: 15px;
  letter-spacing: 0;
}

.due-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 11px;
  align-items: start;
  border: 1px solid #ded7cb;
  border-radius: 8px;
  padding: 14px;
  background: #fffdf8;
}

.due-card.overdue {
  border-color: #df9a7d;
  background: #fff5ef;
}

.due-card.daily {
  border-color: #9fc6b2;
  background: #f4fff8;
}

.review-badge {
  width: 58px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  background: var(--blue);
  font-size: 13px;
}

.overdue .review-badge {
  background: var(--warning);
}

.daily .review-badge {
  background: var(--green);
  font-size: 12px;
}

.due-card h3 {
  margin-bottom: 4px;
  font-size: 16px;
  letter-spacing: 0;
}

.meta {
  margin-bottom: 9px;
  color: #67717a;
  font-size: 13px;
  line-height: 1.4;
}

.done-button {
  border: 0;
  background: #263044;
  color: white;
  box-shadow: 0 10px 20px rgba(38, 48, 68, .18);
}

.attitude-options {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.attitude-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid #eadbc4;
  border-radius: 8px;
  background: #fffaf0;
  padding: 10px;
  cursor: pointer;
}

.attitude-option input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--green);
}

.attitude-option span {
  display: grid;
  gap: 3px;
}

.attitude-option strong {
  color: #263044;
  font-size: 13px;
}

.attitude-option em {
  color: #1e7a51;
  font-style: normal;
}

.attitude-option small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.record-table {
  min-width: 980px;
}

.plan-table {
  min-width: 1040px;
  border: 2px solid var(--ink);
}

th,
td {
  text-align: left;
  border-bottom: 1px solid #e4ded3;
  padding: 10px;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: #fbf7ef;
  color: #4a535c;
  font-size: 13px;
}

.piece-name {
  font-weight: 760;
  color: var(--ink);
}

.muted {
  color: #6a737b;
}

.next-needed {
  color: var(--blue);
  font-weight: 760;
}

.status-tag {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 760;
}

.today-tag {
  background: #ffe7a7;
  border: 1px solid #e1bd5e;
  color: #6b4c00;
}

.overdue-tag {
  background: #ffe1d5;
  border: 1px solid #df9a7d;
  color: #8f3219;
}

.pause-tag {
  background: #d8f0e2;
  border: 1px solid #9fc6b2;
  color: #1f6846;
}

.plan-title th {
  background: white;
  border: 2px solid var(--ink);
  text-align: center;
  font-size: 24px;
  color: #111;
  padding: 14px;
}

.plan-goal td {
  border: 2px solid var(--ink);
  font-weight: 760;
  background: white;
}

.plan-table th,
.plan-table td {
  border: 1.5px solid var(--ink);
  color: #111;
  text-align: center;
}

.plan-table thead tr:last-child th {
  background: var(--lavender);
  font-size: 14px;
}

.plan-table td:nth-child(4),
.plan-table th:nth-child(4) {
  text-align: left;
}

.plan-table .today-row td {
  background: #fff2be;
}

.plan-table .break-row td {
  background: #eef8f1;
}

.plan-cell {
  display: grid;
  gap: 4px;
  text-align: left;
}

.plan-cell strong {
  font-size: 13px;
}

.plan-cell span {
  color: #4e5962;
  font-size: 12px;
}

.dialog {
  border: 0;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}

.dialog:not(.wide-dialog) {
  width: min(520px, calc(100vw - 32px));
}

.wide-dialog {
  width: min(1120px, calc(100vw - 32px));
}

.dialog::backdrop {
  background: rgba(22, 28, 33, .36);
}

.dialog-header {
  padding: 16px;
  background: var(--dark);
  color: white;
}

.split-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.dialog-header h2 {
  margin: 0;
  font-size: 20px;
}

.dialog-body {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: #424b53;
  font-weight: 750;
  font-size: 13px;
}

input {
  width: 100%;
  border: 1px solid #cfc7b9;
  border-radius: 8px;
  padding: 12px;
  font-size: 16px;
  background: #fffdf8;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 16px 16px;
}

.holiday-form {
  display: grid;
  gap: 12px;
}

.score-form {
  display: grid;
  gap: 12px;
}

.holiday-list {
  margin-top: 14px;
}

.score-adjustment-list {
  margin-top: 14px;
}

.holiday-ranges {
  display: grid;
  gap: 10px;
}

.score-adjustments {
  display: grid;
  gap: 10px;
}

.holiday-range {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid #ded7cb;
  border-radius: 8px;
  background: #fffdf8;
  padding: 12px;
}

.score-adjustment {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid #ded7cb;
  border-radius: 8px;
  background: #fffdf8;
  padding: 12px;
}

.holiday-range div {
  display: grid;
  gap: 3px;
}

.score-adjustment div {
  display: grid;
  gap: 3px;
}

.holiday-range span {
  color: var(--muted);
  font-size: 13px;
}

.score-adjustment span {
  color: var(--muted);
  font-size: 13px;
}

.compact-empty {
  padding: 14px;
  text-align: left;
}

@media (max-width: 940px) {
  .app-shell {
    padding: 14px;
  }

  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .grid-layout {
    grid-template-columns: 1fr;
  }

  .records-panel,
  .holiday-panel,
  .score-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .reward-card {
    grid-template-columns: 1fr;
  }

  .reward-avatar {
    width: 68px;
    height: 68px;
    font-size: 36px;
  }

  .button {
    width: 100%;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .holiday-range {
    align-items: stretch;
    flex-direction: column;
  }

  .score-adjustment {
    align-items: stretch;
    flex-direction: column;
  }
}
