:root { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }

body {
  min-height: 100vh;
  background: var(--pico-background-color);
  color: var(--pico-color);
  display: flex;
  justify-content: center;
  padding: 24px;
}

main.container { 
  width: 100%; 
  max-width: 100%;
  overflow-x: hidden;
}

.app {
  width: min(720px, 100%);
  margin: 0 auto;
  max-width: 100%;
  box-sizing: border-box;
}

.header {
  margin-bottom: var(--pico-spacing);
}

.header h1 {
  margin: 0 0 var(--pico-spacing) 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--pico-spacing);
}

.actions-left {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-left: 0;
  padding-left: 0;
}

.actions-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

#lang-select {
  margin: 0;
  height: 2.75rem;
  width: auto;
  min-width: 4.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

#add-btn,
#remove-done-btn,
#theme-toggle {
  margin: 0;
  height: 2.75rem;
  width: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn {
  padding: 0;
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1;
}

@media (max-width: 640px) {
  body {
    padding: 12px;
  }

  .app {
    padding: 1rem;
  }

  .header {
    margin-bottom: 0.75rem;
  }

  .header h1 {
    font-size: 1.25rem;
    margin: 0 0 0.5rem 0;
  }

  .header-actions {
    margin-bottom: 0.75rem;
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .actions-left,
  .actions-right {
    gap: 0.25rem;
  }

  #lang-select {
    height: 2.5rem;
    min-width: 3.5rem;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
  }

  #add-btn,
  #remove-done-btn,
  #theme-toggle {
    height: 2.5rem;
    width: 2.5rem;
  }

  .icon-btn {
    font-size: 1.1rem;
  }
}

.list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.empty {
  color: var(--pico-muted-color);
  text-align: center;
  padding: 1rem;
  border: 1px dashed var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  background: var(--pico-card-background-color);
}

.item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  background: var(--pico-card-background-color);
}

.item.priority-high {
  background-color: rgba(220, 53, 69, 0.15);
}

.item.priority-medium {
  background-color: rgba(255, 193, 7, 0.15);
}

.item.priority-low {
  background-color: rgba(40, 167, 69, 0.15);
}

[data-theme="dark"] .item.priority-high {
  background-color: rgba(220, 53, 69, 0.25);
}

[data-theme="dark"] .item.priority-medium {
  background-color: rgba(255, 193, 7, 0.25);
}

[data-theme="dark"] .item.priority-low {
  background-color: rgba(40, 167, 69, 0.25);
}

.item input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  cursor: pointer;
}

.title {
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.done { color: var(--pico-muted-color); text-decoration: line-through; }

dialog {
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  padding: var(--pico-spacing);
  background: var(--pico-card-background-color);
  color: var(--pico-color);
  width: min(480px, 90vw);
}

dialog::backdrop { background: rgba(0, 0, 0, 0.45); }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.375rem;
}

.dialog-actions button {
  touch-action: manipulation;
  min-height: 44px;
  flex: 1 1 0;
  padding: 0.5rem 1rem;
  cursor: pointer;
  white-space: nowrap;
  max-width: 120px;
}

